An extremely 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 changed integer.c, is completely wrong. It never
should have been committed. You can use svn 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. (You can do this by specifying
--revision 303:302, or by an equivalent
$ svn merge -c -303 http://svn.example.com/repos/calc/trunk --- Reverse-merging r303 into 'integer.c': U integer.c $ svn status M . 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.
As we mentioned earlier, one way to think about a repository
revision is as a specific changeset. By using the
option, you can ask svn merge to
apply a changeset, or a whole range of changesets, to your working copy.
In our case of undoing a change, we’re asking svn merge to apply changeset #303 to our
working copy backward.
Keep in mind that rolling back a change like this is just like any other svn merge operation, so you should use svn status and svn diff to confirm that your work is in the state you want it to be in, and then use svn commit to send the final version to the repository. ...