Is there a way to perform an svn add command that will add only unversioned files?

Currently if I try to do svn add on a direcotry that contains a mix of versioned and unversioned files I receive the mydir/ is already under version control message.

link|improve this question

feedback

2 Answers

up vote 4 down vote accepted

If you're on a Linux/UNIX commandline:

svn status | grep '\?' | awk '{print $2;}' | xargs svn add
link|improve this answer
1  
Just to be slightly more explicit: grep '^\?' – andol Jul 19 '10 at 16:37
Absolutely fantastic! One wonders why svn does not support this natively though. – Camsoft Jul 19 '10 at 17:50
Camsoft, you can modify that line to do removes, moves, deletes, etc, just change out the ? mark and the svn add command to do a different function. For example, to remove all missing files: svn status | grep '^\!' | awk '{print $2;}' | xargs svn rm – James Jul 19 '10 at 18:03
Nice one thanks! – Camsoft Jul 19 '10 at 18:48
Yup. If you're anything like me, you'll end up with a small collection of one-liner shell scripts for doing common batch svn stuff. @Camsoft: One wonders why svn does not support a lot of things natively ;) – jeremiahd Jul 22 '10 at 0:53
feedback

Try svn add * --force to force it into the already version controlled directory.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.