Better way to revert to a previous SVN revision of a file?
I accidentally committed too many files to an SVN repository and changed some things I didn't mean to. (Sigh.) In order to revert them to their prior state, the best I could come up with was
svn rm l3toks.dtx
svn copy -r 854 svn+ssh://<repository URL>/l3toks.dtx ./l3toks.dtx
Jeez! Is there no better way? Why can't I just write something like this:
svn revert -r 854 l3toks.dtx
Okay, I'm only using v1.4.4, but I skimmed over the changes list for the 1.5 branch and I couldn't see anything directly related to this. Did I miss anything?
Edit: I guess I wasn't clear enough. I don't think I want to reverse merge, because then I'll lose the changes that I did want to make! Say that fileA
and fileB
were both modified but I only wanted to commit fileA
; accidentally typing
svn commit -m "small change"
commits both files, and now I want to roll back fileB
. Reverse merging makes this task no easier (as far as I can tell) than the steps I outlined above.
Solution 1:
svn merge -r 854:853 l3toks.dtx
or
svn merge -c -854 l3toks.dtx
The two commands are equivalent.
Solution 2:
Check out "undoing changes" section of the svn book