Jay Fields
Posts: 765
Nickname: jayfields
Registered: Sep, 2006
|
Jay Fields is a software developer for ThoughtWorks
|
|
|
|
Subversion: Rolling back revisions
|
Posted: Feb 9, 2008 10:48 AM
|
|
Earlier this week someone mistakenly checked in some experimental code and wanted to back that code out. If you've never needed to do this, you might think that Subversion gives you a command to make this happen easily, it doesn't. In fact, I've found that to be a fairly common misconception.
There may be easier ways, but the following steps are the ones I take to roll back a specific revision.
Find the revision that you wish to back out. This can be done with various tools, but 'svn log --limit 10' will probably do the trick. Once you have the offending revision you are ready to get started. (Revision X in the example is the revision that needs to be rolled back and revision Y is the revision that came immediately before X [i.e. X-1])- svn diff -rX:Y > a.patch
- patch -p0 < a.patch
- svn commit
note: while it's possible to give patch parameters and do this pretty much anywhere in the tree, I'd stick to doing this in the root folder of your project, for simplicity.
Again, there is probably an easier way to do this (which is part of my motivation for writing this entry), and obviously this solution depends on having 'patch' available.

Read: Subversion: Rolling back revisions
|
|