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!

Thank you so much for telling this! I really appreciate it, because I have looked everywhere on the internet and couln’t find it immediately, thanks!
You just saved my ass
saved me hours of work =) thanks for the tip bro
FYI I’ve implemented a GUI method to do this operation in MonoDevelop:
https://bugzilla.novell.com/show_bug.cgi?id=394434
Regards.
Worked perfectly, thanks :)
Many thanks, very helpful post
Tortoise svn does this well
Excellent.
I was originally looking at the svn revert and checkout commands, but they really don’t have the right semantics. Thanks, merge is perfect!
Hi there, I want to revert my working copy back to revision 3 which is my latest checked-in revision. I do the following:
% svn merge -rHEAD:3 ./
Now I would expect that there should be no difference between my (reverted) working copy and the latest revision in the repository (revision3). However it appears that the merge did not work, as:
% svn status
? sites/all/modules/cvs_deploy
M sites/all/modules/CVS/Entries.Log
M sites/all/CVS/Entries
! sites/all/CVS/Entries.Log
M sites/CVS/Entries
! sites/CVS/Entries.Log
M misc/CVS/Entries
! misc/CVS/Entries.Log
M CVS/Entries
! CVS/Entries.Log
! includes/CVS/Entries.Log
! modules/aggregator/CVS/Entries.Log
M modules/color/CVS/Entries
! modules/color/CVS/Entries.Log
! modules/node/CVS/Entries.Log
M modules/CVS/Entries
! modules/CVS/Entries.Log
Perhaps I am doing something wrong or not understanding something.
Please, any explanations or comments?
Thank-you in advance,
Michelle
Thanks, but that didn’t work:
svn merge -rHEAD:85008
svn: Try ’svn help’ for more info
svn: Merge source required
You missed the trailing ‘.’!
Thanks!
Thanks a lot. I googled “subversion revert to revision” and found this post which solved my problem in five seconds :-)
Another ass you’ve just saved is mine, thanks!
Brilliant!