18 Apr 2007

SVN: Update To Older Revision

This probably come in handy if the current revision that you’ve updated to had a problem. svn update -r REV, where REV is the previous revision number before the problem occur.

Comments RSS feed

4 Comments

  1. freereign

    Thanks for the tip!

    Reply

  2. Timo Meinen

    I don’t think, this will work. Have a look at the svnbook:

    “Many Subversion newcomers attempt to use the above svn update example to “undo” committed changes, but this won’t work as you can’t commit changes that you obtain from backdating a working copy if the changed files have newer revisions. See the section called “Resurrecting Deleted Items” for a description of how to “undo” a commit.”

    Timo

    Reply

  3. First you update back to the old version.

    Then save that file/directory or whatever as file.old (in the case of a directory, actually move the whole thing out of your svn repository structure to get it out of the way for a moment)

    Next, svn up the file or directory to your current version.

    Copy your .old file or directory over top of your now-current files.

    svn commit the whole shebang back up with a memo like “Rolled back to version xx”

    Reply

  4. Timo and Lisha, there are two different scenarios:
    1) You just want an earlier version of the code to use but not commit on.
    2) You want to rewind the codebase to an earlier version and then be able to work with/commit using the earlier version as a starting point.

    The post covers how to do #1. For #2, you can do as Lisha suggests, but the more “standard” method is described here: http://jacwright.com/blog/75/how-to-roll-back-chan...

    Reply

Leave a Reply

You can use these tags: <a href="" title=""> <ol> <ul> <li> <strong> <em> <pre> <code> <blockquote cite="">