XCode 4.2 Source Control problems - xcode

I seem to have a major problem. I opened up Xcode and my main view controller code seems to have been replaced with the original code, it's all gone. All my other files have the little 'M' for modified icon next to them, this problem file however does not. It seems like it's gone back to the original version.
Now, Can I go back to my modified version, or is it all gone? This is a for a test app so although not crucial, I'd really prefer to not lose it all :)
Thanks

Just putting an answer here as I hate to leave things with no answers. Dropbox sorted my problem as I had a backup copy of everything, and I am yet to find out what went wrong. I'm now using a combination of Dropbox and a GIT repo to keeps things save.

Related

I have a bunch of files in my stage area which is causing issues and I don't know how to remove them

I was working on a static website and decided to change my account as I recently changed my Github username. When I say account, I mean the icon in the bottom left corner of VS Code. In doing so, 10k files were added, and all my extensions disappeared.
The staged files include App Data files that I can't clear.
My Discord is affected. I can't open it as when I do, a message comes up and says:
'update.exe' has been moved or changed. Would you like to delete the shortcut?
Although it's an issue, I essentially have to reinstall it, but the same issue may still arise, which it has as I've tried reinstalling it.
My concern is I feel I may affect other programs by trying to come up with a solution.
I'm posting this question to get help on removing the 10k files that are staged and do not affect program files/app data. When I try to commit these files, I get an error saying,
Git Fatal :pathsepc C\Users.....\getconfig did not match any files
I would think all I need to do is add these files to a gitignore file, but I would need steps if so.
I hope I've explained my problem clearly to get a solution.
Please help.
Staged files

Restoring an Xcode commit that was never pushed to Github

This is a question that I posted, and then after much digging finally resolved myself. There is actually quite a bit on this subject both on this forum and elsewhere, but it usually requires some familiarity with Terminal. I am going to describe the problem I faced and then describe step-by-step in detail (at a beginner's level) how to resolve the issue in Terminal.
In short, I checked out a previously committed version of my app in Xcode, which - because it was a version from several weeks prior - did not contain my most recent commits. In other words, I had no access to any of the commits that contained my most recent work. They had all disappeared.
My commits and pushes had not stored in GitHub because presumably some time before this I had accidentally selected my main folder as the destination for my commits, rather than one of the two branches I created. So I had absolutely no access to my work. By all appearances I pretty much had to start from scratch.
After much hand wringing, teeth gnashing, and hours of scouring the webs, I finally uncovered the solution. But it takes a bit of understanding about Terminal to make it work. So after several more hours of learning Terminal, I finally successfully restored all of my work.
For any of you who are new to coding (as I am), and who have no experience with Terminal, I will provide detailed instructions on how to resolve this issue if you encounter it in the answer below.
Open Terminal to prompt to your Xcode project. The easiest way to do this is to find your project in Finder, which will have a .xcodeproj extension, and then right click it.
Select New Terminal at Folder.
At this point, a terminal window will pop up. From here, enter the following: git reflog
Press Enter
This will populate a list of all the commits stored in your Xcode project. Each commit is identified by an alphanumeric code (the one I restored was 1a7ea33, for example).
Note the alphanumeric code of the commit you wish to restore.
After this, enter the following: git checkout -b NewBranch 1a1a1a1 (where "NewBranch" is whatever name you decide to name your new branch, and "1a1a1a1" is your alphanumeric code from steps 5 and 6).
Press Enter.
That's it. Close Terminal and open your Xcode project as normal. You will notice the restored commit in the folder you just named in Terminal.
Hopefully no one will ever need this, but if by chance someone does I hope it helps.

Problems Using Snapshots in Xcode 5 Mac

A couple of people have asked a similar question, the last one a year ago, with no solution (Here and here), so I thought I'd try it again.
I've created snapshots in Xcode 5.1 on a few occasions before making significant code changes. When I go to restore them, I've seen a couple of different behaviors:
There's one file that changed. Xcode shows me the before and after diffs, and I say OK, and click on Restore. The result, nothing's changed.
Same as one, except in this case there are multiple files that have changed. It shows me one, and it looks good. So I click Restore. It doesn't show me any of the other files diffs that have changed, and it doesn't prompt me to be sure I don't want to look at them. After the fact, I've surmised that I need to click on each changed files in order to accept the changes. But still, there's only one Restore button, which dismissed the window. In any case, none of the files have been restored to their former state. If I try to restore from that same snapshot again (naively thinking I could try to retrieve the other changed files), it tells me that the current state and the snapshot are the same.
If I export the changes to another directory, then I do get the reverted files. It's when I do a File->Restore Snapshot where I get no results.
I've taken to manually creating zip archives of the source so I can recover the files manually.
I don't have any Source Control in use in Xcode so far. It seems I should do that if only to do periodic commits on my own.
Do other people use snapshots successfully? Has anyone else experienced this behavior in Xcode 5?
Thanks much for your help. I've yet to get any response on the Apple Developers Forum on the topic :(
-Eric

Recover deleted files from Xcode4

I am new to git and to Xcode, and mac in general, so here's my question
I accidentally added my whole desktop to a project i was working on. When I wanted to delete the files, Xcode asked me if I wanted to delete them from disk and I said yes. The problem is that the project itself was in a folder inside my desktop and it took out everything. I had not committed my changes in the git local branch. Is there any way to undo what I did?
I appreciate whatever help I can get.
If you have not committed, Git cannot help you bring back your project. You will have to look at other alternatives ( like TimeMachine if you had it setup? )
If anyone's experiencing trouble with this problem, I nearly went back in my project and changed everything all over again but then remembered that it may not have been legit deleted yet. That is all to say that you should CHECK YOUR TRASH first! I don't know why it didn't occur to me until awhile after I had accidentally deleted it, but I ended up finding it in the Trash, so I'm thankful for that. Hope I've saved someone a whole lot of trouble!
Stop using the HDD immediately. Get Data Recovery help. Top of the line Data Recovery services may charge 1K-3K but can do an amazing job. Worth trying if your job is on the line.
Also, don't lose heart. Doing it the second time (if it comes to that) will take much shorter time than the original one.

Is it possible to find a deleted xcode file?

I highlighted a line of code I was going to delete after building and running the app. After I ran the app, the code was still highlighted so I pressed delete and my entire class was deleted... I am an idiot...
The file did not go to the trash so I thought xcode might store it somewhere, does anyone know if it is possible to retrieve this file?
you can easily revert if you are using version control. if you are not using it (yet), you should -- worse things happen.
if you don't use version control and you use xcode's snapshots... you could look there. you may also be able to find it using Time Machine.
but... add "learn version control" to your #1 thing to learn this week for development.
I used the Disk Drill to restore mistakenly deleted files.
check http://www.cleverfiles.com/

Resources