
awk and xargs. Deep cleaning action for those hard to reach places. Sometimes you just want your subversion working copy to be clean. If you have files with changes you can just revert things, but what about files that aren't under version control? Those are harder to clean up, especially if they are spread all over the place. Here is what I do when I want my working copy to be identical to the repo:
svn st | awk '{print $2}' | xargs rm -rfThat will remove all files that are out of sync with the repository. Then simply update to restore things you deleted and get up to date.
svn up
5 comments:
Make sure that you've no edits or adds! Safer command might be:
svn st | grep '?' | awk '{print $2}' |xargs rm -f
Good point Julian. You would only want to use my command if you were sure there were no important modifications in your working copy. Some svn st and svn diffing would be in order before pulling the trigger on mr. clean :)
http://generaldevelopertips.blogspot.com/2009/08/subversion-stripping-working-copy.html
What about ignored files? E.g.
svn st --no-ignore
I've wrapped this up in a script which lets you preview the files it's about to delete and which has a switch for whether to include ignored files (see craig's comment).
Post a Comment