Wednesday, November 21, 2007

SVN undo a change

Assume that revision 92 contains the changes we are undoing.

In order to undo a commit that has been made to the repository we just tell SVN to apply the reverse of the changeset to our working copy in the current directory.

svn merge --revision 92:91 .

The output will show files being updated or deleted, we can now check those changes.

svn diff

And if all looks good we can commit our repaired files.

svn commit -m "removing changes from revision 92"

Good to go!

References:
http://seamlesstrust.org/trustwiki/index.php/SVN_Undo_Operation
http://www.jamescooke.info/blog_archive/how-to-undo-a-subversion-commit/

3 comments:

der Dennis said...

Just as an little update:

You could also use the following command:

svn merge --change -92

IMHO this syntax is a little easier on the eye...

Unknown said...

Don't forgot the dot or it'll complain:

svn merge --change -92 .

Unknown said...

Don't forget the tailing dot or it'll complain:

svn merge --change -92 .