To revert a particular folder in SVN to its previous state I currently use the following:
svn rm folder svn commit -m 'removed folder to revert to previous version' svn co http://pathto/repo/folder@268 cd folder rm -rf .svn //recursively if many folders svn add folder svn commit -am 'reverted to the previous version'
Seems too much trouble for what should be a fairly common use case. I must be doing it wrong. How else can you do it?
To revert single change (e.g. made in revision 666): cd folder svn merge -c -666 . To revert local changes (not committed yet): cd folder svn revert -R .
Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes.
To revert a single commit: Go to: Subversion -> Integrate Directory... Show activity on this post. Note that the svn merge command reverts a commit in the sense of having another commit undoing your changes, but keeping your wrong commit in the history.
If you want to write a script which requires no input, you should use the official Subversion command line client instead. checkout a working copy in REV revision: svn checkout --revision REV https://svn.example.com/svn/MyRepo/trunk/ svn checkout https://svn.example.com/svn/MyRepo/trunk/@REV.
Why not using svn merge
?
Assuming you want to revert from current HEAD (last committed) version to revision 268:
cd folder svn up svn merge -r HEAD:268 .
Then resolve any conflicts manually (there should be nothing if there is no local change) and:
svn commit -m "- reverted to revision 268"
To revert single change (e.g. made in revision 666):
cd folder svn merge -c -666 .
To revert local changes (not committed yet):
cd folder svn revert -R .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With