This works if all of the files that `svn info` lists as ‘?’ are files you actually want to add:
svn st | grep "^?" | awk '{ print $2}' | while read f; do svn add $f; done
If you want to see what’s going on there, start by running svn st and add new sections of the pipeline one at a time to see what each is doing.
social bookmark of choice:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Was this post useful or entertaining? Subscribe to my feed!
This entry was posted
on Monday, May 22nd, 2006 at 10:29 am and is filed under Bash, version control.
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
May 22nd, 2006 at 9:43 pm
I’ve done similar (though with cut instead of awk) and this will usually work, but if it’s possible you’ll work with files with spaces in their names, surround the “$f” with double quotes. xargs should work too, though I haven’t tried it, and might be faster on a large add.
Nice tip.
July 10th, 2006 at 5:21 am
Great tip. It really helped me as I needed to add over 50 files - and I’m to lazy to do it by hand. Thanks.