RSS

Category Archives: revert

>Undo recent Subversion commits (updated)

>Here’s a quick HOWTO for undoing recent Subversion commits. Do:

svn merge -r NEW:OLD PATH

where

  • NEW is the new (bad) revision;
  • OLD is the old (good) revision;
  • PATH is the file or directory to revert.

For example:

svn merge -r 1680:1667 src/test.java

Hints:

  • Don’t forget to commit afterwards.
  • Instead of a revision number, you can also use the literal string HEAD for the most recent revision.
  • You can only pass one path at a time, but this can be a directory name instead of just a file name. To process multiple paths in a row on a UNIX/Linux/Mac system, use:
    for f in path1 path2 path3; do svn merge -r NEW:OLD $f; done

Updated (Nov. 27, 2008): Added some hints.