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 vers
Why not using 'svn merge'? That's why: "Then resolve any conflicts manually[..]"
If I know 'folder' at revision 268 contains the consistent data I'd like to go on with, why automatically create a merge with potentially inconsistent data only to manually remove those changes later. It's error prone and defeats the purpose of my configuration management tool.
I.e. I'd prefer the recipe from the original request with a minor improvement. If you use 'svn export' to get the old revision you don't have to remove .svn files:
svn rm folder
svn commit -m 'removed folder to revert to previous version' .
svn export -r 268 http://pathto/repo/folder
svn add folder
svn commit -m 'reverted to the previous version' folder
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 .
You can use svn merge
for this task, see http://svnbook.red-bean.com/en/1.1/ch04s04.html#svn-ch-4-sect-4.2 for an example
you could also use
svn revert folder/*
which will revert all the file under folder