J Duh
J Duh

Reputation: 161

I accidentally closed my Xcode application. How do I undo any changes?

I was testing out some new swift code. I knew that if I made any mistake I could simply revert back to my old code by pressing Command+Z.

But I accidentally closed my Xcode Editor while writing new code.

How would I undo the new changes and go back to my old original code? I did not make use of github for this.

Upvotes: 1

Views: 1277

Answers (1)

Patrick Dougherty
Patrick Dougherty

Reputation: 122

There might be a chance you can view the file's old history. Check out George Marmaridis' answer

Here is what he says:


You might not be out of luck. Although Git can't help you, Finder may be able to come to the rescue!

If you have not turned off the Versions feature (which by default is turned on and you need a Terminal command to disable), then do the following:

  1. Quit Xcode.
  2. Open the file you wish to bring back your lost changes to using TextEdit.
  3. Go to File > Revert To > Browse All Versions...
  4. Scroll through the available versions. Hopefully you will have many available to choose from.
  5. Select a version and hit Restore.
  6. Follow 2-5 for all necessary files.
  7. Launch Xcode. You should now see the M next to these files in Project Navigator indicating they include uncommited changes (the changes you previously discarded).

Upvotes: 11

Related Questions