How to Rollback a SVN Repository to a Previous Revision…7L style

Posted on July 20th, 2009


Sometimes you might get confused about what to do if you accidentally commit something to a SVN repository. If you want to rollback the SVN repository to the revision before your last commit, this is what you need to do.

Before the merge, you need to update your local copy of the code base to the latest

# svn up or svn update

And then merge the previous revision to your current code base.

For example, you want to remove reversion from 100 to 123. The latest code is 124.

# svn merge -rHEAD:100-123 https://repo.sevenl.net/project1/trunk /home/sevenl/project1/trunk

  1. HEAD – indicates the revision of the local copy of the code is the latest revision.
  2. 100-123 – is the revision which want to rollback.
  3. https://repo.sevenl.net/project1/trunk- is the project’s URL in SVN repository
  4. /home/sevenl/project1/trunk – is the path to the local copy of the project

Done….

You may want to know how to do it through Totois SVN

1. Right clock on your repository folder and then move to TortoiseSVN -> Merge

2. Select Merge a range of revisions and then click Next

1

3. URL to merge from https://repo.sevenl.net/project1/trunk

4. Revision ange to merge: 100-123

5. You should check: Reverse merge

2
6. and then Next, please test it first.

3

There you go.