Revert to a Previous Revision in Subversion
Posted On: October 8, 2010 at 11:55 a.m.
Recently I was working on upgrading a website with some new functionality, but after several commits my changes weren’t working as well as I wanted and I found a better way to get it done. Problem is, I’ve been committing to my subversion repository this whole time. So I’m currently at revision 27 but I need to reset the svn repo back to revision 21 to get back to the stable code. Subversion actually made this really easy. Here’s what I did from within my local working copy:
svn merge -rHEAD:21 .
Subversion then compares the changes made between the current version (HEAD) and the referenced revision, in this case 21, and then rolls back the changes so you’re back where you need to be. Reset complete! Note that you do need to commit the changes to actually update the repository.


Comments