问题
I'm using SVN in Xcode 4 as my source control; but can't see any option to revert to an older revision? Either a 'revert' or an 'update to revision' command? The 'Update' option always seems to update to the HEAD.
Of course - I can do this on the command-line, but can't believe there's no way to do it within Xcode...
Does anyone know where it's hidden? Or is there really no such option?
回答1:
Unfortunately the SCM functionality in 4.0 is fairly limited. You can commit, switch branches, branch/merge, diff previous versions, update to HEAD, but you can't revert.
We all expect this to get better in successive updates but it does seem like a rather silly omission. The Time-Machine-like diff version picker seems the perfect place to put the UI, so I'd expect it to appear there when it's finally supported.
回答2:
You can "Discard Changes". That will revert the selected file(s).
回答3:
Just a work around: As it isn't possible to revert with Xcode - you could use any SVN tool e.g Tortoise on a Windows machine and this Tutorial.
If you just need to compare a method or so you could also just simply compare to an older version by going to Organizer -> Respositories -> Your Project -> below in the history click the file -> View Changes. (Xcode 4)
If you screw up your project file you could still go oldschool and copy a working revision of the file to an usb stick by using Tortoise and replacing it in your project. That's what I just did ;)
回答4:
This is kinda old question, but I manage to find a way to find and revert to old versions. As it is a Mac built in feature, not a xcode thing, it will find ALL saved versions of a specific file. But it can save you on hard times, like it saved me :~
How to revert/recover .m file to a previous version? (autosaved blank by mistake and xcode crashed - no Source Control, no Time Machine)
Summing up: I've opened the "file.m" I need to recover with TextEdit. Then I browse to:
File > Revert To > Browse All Versions
There I manage to find all versions of the file and could pick the one that I need.
来源:https://stackoverflow.com/questions/5417687/where-is-the-revert-option-in-xcode-4s-source-control