Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 6 down vote accepted

If you're on a Linux/UNIX commandline:

svn status | grep '\?' | awk '{print $2;}' | xargs svn add
share|improve this answer
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

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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