Search code examples
svnrevert

Reverting in subversion


Say I want to revert some changes between version n and (n-1) in Subversion.

I would just put back the files from version (n-1) - take them from the repository and check back in as the latest version in the trunk.

Here it seems they want to make a branch from version (n-1) and merge it back with the trunk.

How is this better or "more correct"?

In this case it is a few files within one directory. These files do not have other recent changes.


Solution

  • To remove changes between specific revisions, say 1000 and 1010 in the past:

    From a checked out, up to data working copy type:

    svn merge -r 1010:1000 .
    

    This removes all the changes in your working copy between revisions 1000 and 1010 (not including changes added to 1000 itself). It's safe to play around with this as long as you don't have any local modifications and don't check the results back in until you've verified that it did what you wanted.

    In your particular case since you only want to remove a single revision you can use '-c' instead of the more general -r:

    svn merge -c 2000 .
    

    This is equivalent to -r 1999:2000 removing the changes between 1999 and 2000.