How to add multiple files to Subversion
Posted By Slobodan Kovacevic on July 10, 2006
After switching completely to Ubuntu I also had to switch from TortoiseSVN to plain svn command line. The problem I have is that I don’t see any way to add multiple files to SVN with one command.
I want to be able to add ALL files that aren’t under Subversion version control and use a single command to do it (as opposed to issuing bunch of ’svn add file1 file2…’ commands). I’d like to have something like:
svn add ./*
Now since I’m lazy and not exactly an shell scripting expert I found a someone else’s solution to this problem. In a blog post add multiple files in subversion at once proposed solution is to use following line (it’s a slightly modified version of original line):
svn st | grep "^?" | awk '{ print $2}' | while read f; do svn add "$f"; done
Basically, it will first list all files that have been changed, then filter out those that have ? as status (hint: files that aren’t under version control), extract file names and then for each file issue a separate ’svn add’ command. I just tried it and it works great.
Comments
Benjamin Selmer says:
Jose says:
roamer says:
Yozone Wong says:
4 Responses to “How to add multiple files to Subversion”
December 16th, 2008 at 2:08 pm
I think this would work to:
svn st | grep “^?” | cut -b 8-1000 | xargs svn add
January 13th, 2009 at 8:37 pm
SVN does support this:
svn add * –force
January 13th, 2009 at 9:26 pm
thanks Jose that works quite well it is two dashes
May 19th, 2009 at 4:44 am
Thx, It worked very well