Subversion: revert file to older revision

Who doesn’t know the following situation:

The file somestuff.c is in the HEAD revision, but it is not working anymore. Now you want to revert it to the revision 10 (which is may be HEAD-1). One way doing that is to update to the files correct version by:

svn up -r 9 somestuff.c

Then copy the file to a file temp.c, update the folder to HEAD by svn up, then move back the temp.c file to somestuff.c. Simple, isn’t it?

Actually there is a lot easyier way:

svn merge -r HEAD:9 somestuff.c

Leave a comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.