Reverting a commit in subversion

Some days ago someone commits a revision in svn which has to be rolled back for some reason. In Subversion it is not that easy like in git where you can call a simple git revert ID, because subversion does not have a command revert. This command rolls back changes made in revision N, using a reverse merge:

svn merge -c -N .

Note the minus character in front of N. This is the same as the following command (which also works with older subversion clients):

svn merge -r N:N-1 .

Rolling back multiple changes (let’s say revisions LOW to HIGH, both inclusive) works the same way:

svn merge -r HIGH:LOW-1 .

Afterwards examine the changes made to the working copy and commit them.

comments powered by Disqus