Category Archives: subversion

>Undo recent Subversion commits (updated)

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

svn merge -r NEW:OLD PATH


  • 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/


  • 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.


>SVK version control system (updated)

>Update (August 27, 2009): It’s probably better to use git-svn (instead of SVK), a conduit between local git repositories and a regular remote Subversion repository.

The original blog post follows below.

A few months ago I switched from CVS to Subversion. All seemed OK, until I tried to add Apple iWork documents (Keynote and Pages) in the repository. These ‘documents’ are in fact complete directories. That’s fine so far, but then when any of these programs saves the document, they purge unknown subdirectories, including those that happen to be called .svn.

So I went looking for a Subversion-oriented solution to work around this issue. What I found instead was not a work-around, but a product that does not expose the weakness Subversion has. It’s called SVK. While based on Subversion, it offers various improvements over the latter:

  • local commits – commit to the remote repository later, keeping all log messages; allows you to work offline for a while and sync when you’re online;
  • faster operations – the ‘status’ and ‘log’ commands are claimed to be much faster;
  • no metadata in subdirectories – this information is stored elsewhere in the file system;
  • smarter merge – making branches less painful;
  • log filtering – find that commit you’re looking for;
  • combine import and checkout – it’s possible to import a directory and convert it to a working copy at the same time, boosting productivity;

Seems there are some reasons to at least consider it for larger projects.

For more information, see the Wikipedia article on SVK.

Leave a comment

Posted by on 8 May 2007 in cvs, subversion, svk, svn, version control