How do I force revert back so a specific revision number using command line SVN?

adam picture adam · Mar 2, 2011 · Viewed 14.1k times · Source

I spoke too soon in my previous post about breaking things.

I am trying to revert back to revision 1124 using the command svn update -r 1124 but I keep getting an error message as follows:

[prague]$ svn update -r1024
U    app/webroot/css/group_themes/green.css
U    app/webroot/css/style.css
Skipped 'app/webroot/index.php'
svn: Failed to add directory 'app/webroot/images/users': an unversioned directory of the same name already exists

We got some stuff back up but still not the exact version which I know I had checked out last night... I thought it would be much easier to just revert back to a specific revision :(

Answer

red picture red · Mar 2, 2011

Without commit

Try to checkout revision 1124 in a new empty directory, so you won't have conflicts with already existing directories.

So svn checkout -r 1124 in a new directory.

With commit

According to the svn manual, if you want to commit a previous revision, you need to use reverse merging. See http://svnbook.red-bean.com/en/1.0/ch04s04.html, 'Undoing Changes'.

svn merge -c -1124 http://svn.example.com/repos/calc/trunk followed by

svn commit -m "Rollback merge to revision 1124"