Ariejan.net has moved and is now available at https://www.devroom.io

Subversion: How to revert to a previous revision

27 March 2007

You’ve been there. You have been developing in your trunk for a while and at revision 127 you get the feeling you’ve done it all wrong! The production server is humming away at revision 123 and that’s where you want to start out again. But how can you start again from revision 123? Easy as this with Subversion:

svn merge -rHEAD:123 .

This will see what changes you’ve made since r123 up until now (r127 in your case) and ‘undo’ them. Next you check in the code and you’ve go a sweet r128 that is exactly the same as r123. You can start over now!