How to retrieve replaced file in xcode
Asked Answered
W

2

8

I accidentally replace one of the .h file in Xcode.Thus the current .h file is empty. Is there anyway i can retrieve it back as it is alot of work.

please kindly provide me with a solution.

Thank you.

Wig answered 22/5, 2013 at 3:21 Comment(1)
Side note - you tagged this as xcode4.3. You really should be using Xcode 4.6 (or the current latest). With Apple's new requirements, you need to be using the latest tools if you intend to submit your app to the App Store.Serilda
I
1

If your project is under Git , and you committed your last version to Git , you can revert to last version.

Else, if you have Time Capsule and you enabled it, you can revert to older time of the document.

Last, if you have none of the above and you have no luck with Cmd + Z , then you have to rewrite it.

Inga answered 22/5, 2013 at 3:30 Comment(5)
Thanks for the reply, is there any third party software that can be used to retrieve itWig
No. You have overwritten the file. Only Time Capsule / Git can help.Inga
@ShivanRaptor It doesn't have to be git. It could be subversion too. Any supported source code control will work. And don't forget about Xcode snapshots. If those are enabled that would be another option to retrieve the file.Serilda
@Serilda yes, but Xcode has built-in Git support and enable by default. but developer often forgets to commit, in my experience.Inga
Time machine saved me!Bluh
L
51

Xcode saves local history of the files but it provides no viewer to see them. You have to open the file with textedit and go "File", "Back to" or "Revert document option" and you will see all the previous revisions.

Loving answered 10/7, 2014 at 17:26 Comment(8)
WOW, THANKS!!!! Saved my life. This should be the accepted one. No matter if you have git or whatever. It just worksSummertree
Should be accepted answer... apple should also bring back snapshots.Confederacy
This is actually incredible. My entire application was in my main.swift which Xcode silently overwrote when adding a target. It was only 120 Lines but was still a good few hours work that I was not keen to recreate! Thank you!Burletta
While breaking up a complex change into a series of commits, Xcode flashed up its stupid "Save Anyway" dialog and I accidentally pressed enter, destroying a lot of work. I got it back via this answer, which may well be the greatest unaccepted answer on Stack Overflow.Mississippian
MAN!!!!! You saved my life!!! Oh my gosh, almost having heart attack! You should be elected as the owner of the world or something!Mccutchen
This seems easier even when source control is being used. Really good to know. Thank-you. I agree that this should be the accepted answer.Airiness
One more life is saved! Thanks!!Envy
Renamed to "Revert to"Leslee
I
1

If your project is under Git , and you committed your last version to Git , you can revert to last version.

Else, if you have Time Capsule and you enabled it, you can revert to older time of the document.

Last, if you have none of the above and you have no luck with Cmd + Z , then you have to rewrite it.

Inga answered 22/5, 2013 at 3:30 Comment(5)
Thanks for the reply, is there any third party software that can be used to retrieve itWig
No. You have overwritten the file. Only Time Capsule / Git can help.Inga
@ShivanRaptor It doesn't have to be git. It could be subversion too. Any supported source code control will work. And don't forget about Xcode snapshots. If those are enabled that would be another option to retrieve the file.Serilda
@Serilda yes, but Xcode has built-in Git support and enable by default. but developer often forgets to commit, in my experience.Inga
Time machine saved me!Bluh

© 2022 - 2024 — McMap. All rights reserved.