Accidently Deleted .m File in XCode 4 - How to Recover?

Vad picture Vad · Dec 16, 2011 · Viewed 10.4k times · Source

In XCode 4 when I was deleting some images I had .m selected as well and oops... it's gone. I has a lot of work done for today. How can I recover? Please help. I did not use Time Machine backup recently and did not back it up somehow else. I need that one copy badly. Anything to try?

Answer

theMikeSwan picture theMikeSwan · Dec 16, 2011

First, you should always make sure the option to create a Git repo is turned on when you create a new project in Xcode. Then you should commit often, like every time you add a feature or fix a bug (maybe more often than that is there is a lot of code being written). That way you can just discard you changes and get back anything you lose.

FOr now recovering the file depends on weather you told Xcode to move the file to the trash or not when deleting and weather or not you have emptied the trash since then. If it is in the project folder or trash just re-add the file if not you need to find a file recovery app and hope the file space hasn't been overwritten yet.