Wednesday, February 25, 2009

svn bad commit?

Suppose you do a bad svn commit. Here is a quick hands-on.

Suppose you have the following revisions:

- r532 - a good commit
- r533 - a "bad" commit
- r534 - another good commit

Now, you realize you shouldn't have svn-committed revision number r533.

What to do? Well, "svn revert" will not be of much help here -- you use "svn revert" just if you mess up a file locally and you want to get the correct one from the svn server.

The answer is:

* cd to the working branch, otherwise you'd get:
svn: Cannot replace a directory from within

* from here, run:
svn merge -r 534:532

* next, you should see:

* after making sure the updated is fine, you should commit your changes and you will therefore have the new revision, r535:
svn commit


Post a Comment