How to undo a commit (or uncommit) in Subversion.
The svn revert command can not be used as it only reverts local changes, ie. restores all files to the checked out revision.
Instead, here's how to do it. Use the svn merge command. It usually merges revisions from one repository into another. However, it can be used to do the opposite: unmerging.
svn merge -c X SOURCE merges commit X from SOURCE repository to working copy. If X is negative it will be regarded as an inverse merge and the commit removed instead of added.
So, the following command reverts revision 34 in the working copy.
svn merge -c -34 .
Don't forget to commit.
18 comments:
Thanks!
Great, exactly what I was looking for.
Thanks for the info ...
I was thinking using a lot of diff and patch
Thanks.
Sweetness. Thanks! :-)
This is more elegant than "-r Y:X"
This is indeed a fantastic resource. Thank you for making this publicly available.
perfect - thanks!
Thanks!
Brilliant - thank you!
Perfect, thanks!
from the help:
-c [--change] ARG:
[merge?] the change made by revision ARG (like -r ARG-1:ARG) If ARG is negative this is like -r ARG:ARG-1
So "-c -34" will be an alias to "-r 34:33"
Thank you very much
Thanks, you've saved me a lot of extra work!
Thanks a lot
cool .. worked like a charm ..:)
*g* thanks :)
Thank you! Your post helps me to solve my problem quickly.
many thanks!
Post a Comment