SVN is one of the great tools when it comes to controlling the version of your code. Code can be committed at instances to the repositories and each change is saved as a change set. Sometimes while working with SVN, there comes a need for reversing a change. Rolling out a committed change set is not straight forward in SVN and may require some trick.
This can be really helpful in case when you are working on a repository copy like
For such situation, you can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository.
For this you need to do is to specify a reverse difference:
$ svn merge -r 783:782 http://svn.windowsvj.com/coderepo/trunk/library/
$ svn status
$ svn diff
# verify that the change is removed …
$ svn commit -m “Undoing change committed in r783.”
Transmitting file data .
Committed revision 850.
By using the -r switch, svn merge apply a changeset, or a whole range of changesets, to the working copy. In this case, SVN merge is applying changeset #783 to the working copy backwards.
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. After committing, this particular changeset is no longer reflected in the HEAD revision.
Although the master branch is Good now, the original change still exists in the repository’s history.
In case, you find an error like :
svn: Cannot reverse-merge a range from a path’s own future history; try updating first
Try updating your working copy before making any commits.