Monday, August 11, 2008

SVN: Add All New Files

I've been doing a lot of Ruby on Rails dev work lately, and the framework tends to generate a lot of files. Until recently, I was using a combination of "svn status" piped into grep, awk, and xargs to accomplish adding new files recursively. A friend recently told me to check out the following solution instead.

svn --force add *

The only negative side effect I can see is that it seems to add ignored files back into the tree. This is mostly a non-issue for me, but take note.

3 comments:

Greg said...

This way you don't add ignored files...
http://www.gregwhitescarver.com/blog/2006/05/22/add-multiple-files-in-subversion-at-once/

Ben said...

Subversion 1.5 has sparse checkouts, so you don't get repository content you don't explicitly want, but can still have an entire tree checked out.

Philip said...

#!/bin/bash

svn st | grep '^\?' | awk '{print $2}' | xargs svn add
svn st | grep '^\!' | awk '{print $2}' | xargs svn rm