SVN Tip: Overwrite Corrupted Revision

Yet again I was saved from a catastrophic failure by using SVN. If you are not using SVN or some sort of version control I highly recommend using SVN as it will save you from losing your work time and time again.
SVN Reverse Merge
The common way to roll back a change is the reverse merge. You are taking the old revision and merging it into your working directory.For instance, here we could merge revision 117 into our working directory with this command:
svn merge -c 117 ./
In the case of a corrupt check in, this may not be possible.SVN was essentially “stuck” for me at a revision because of some errors that occurred (don’t ask me how I got to this point, lol). So I had to come up with another solution…
“Side Steping” Latest Revisions
SVN was corrupted at revision 118+ and so I could not __ get anything working if I svn updated to the latest.
So, I came up with this, “side steping” method where you can roll back to an old revision without having to svn update to the latest revision. To pull it off, we first need to delete the latest working copy, then we resurrect the old revision.
1. Delete the current folder in SVN that contains the corrupted file folder.
svn delete file:///svnroot/domain.com —message ‘deleting corrupt revision’
2. Resurrect the stable revision (in this case #117) with SVN copy . The -r flag allows us to enter the revision number that we want to resurrect.
svn copy -r 117 file:///svnroot/domain.com file:///svnroot/domain.com —message ‘resurrecting the old revision’
3. Check out the latest from SVN and you are back on the road!
svn co file:///svnroot/domain.com
If you are not sure what revision to roll back to, you can always use svn log to review your previous commits to find the stable revision number.
This method sure has saved me from what could have been a world of coding pain.
9 comments
Use git : ).
Thanks Felix, I have heard of git before and will try it when I get the chance.
So did Git work for you?
Gosh, you git folks are persistent!
The interesting part of this is that I did end up (mostly) switching to git. I was having problems with a few SVN repos and needed a more stable alternative. Turns out git is actually really good stuff.
Thank you very much for this tip. It was invaluable.
BZR > GIT
screw git
Thanks. This help me to get rid of wronly moved folders (mv instead of svn move).