Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 5 down vote accepted

If you're on a Linux/UNIX commandline:

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

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

share|improve this answer

Your Answer

 
discard

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.