问题
I have an old revision which works fantastic and I'd like to reverse the past few revisions I've made in SVN. How can I simply remove those revisions and make the HEAD be a specific revision. That way, when I press update, it goes to that revision, and not the real current reivision?
回答1:
From the svn
book:
Undoing Changes
Another common use for
svn merge
is to roll back a change that has already been committed. Suppose you're working away happily on a working copy of/calc/trunk
, and you discover that the change made way back in revision 303, which changedinteger.c
, is completely wrong. It never should have been committed. You can usesvn merge
to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference:
$ svn merge -r 303:302 http://svn.example.com/repos/calc/trunk
U integer.c
$ svn status
M integer.c
$ svn diff
…
# verify that the change is removed
…
$ svn commit -m "Undoing change committed in r303."
Sending integer.c
Transmitting file data .
Committed revision 350.
For more details, see the rest of the "Undoing Changes" section.
回答2:
If you do an SVN HELP MERGE, look at the 3rd form shown (-r N:M). I believe this is the method you want to use.
来源:https://stackoverflow.com/questions/13885640/force-old-revision-to-be-the-newest-revision-svn