Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Add all new files to svn repository (See related posts)

This saves considerable time, and it's recursive:

svn add --force *

Comments on this post

unquiet posts on May 29, 2005 at 21:15
Well I'll be...

That WILL save time.
kch posts on Oct 05, 2005 at 18:14
/me walks away in shame of my previous solution

svn st --ignore-externals | grep ^? | sed 's/\?/svn add/' | sh
danger posts on Aug 18, 2006 at 16:15
I think cch's is better because the "--force" adds all svn:ignored files back into the tree.
batdevis posts on Jan 30, 2008 at 15:34
svn status|awk '{if ($1 == "A") print $2}'|xargs svn add
Whippy posts on May 15, 2009 at 07:04
To get the 'A' status, the file must already be added. You need to match a '?'. Here is what I use:

svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
svn commit

The first grep gets rid of any hidden files (which may be present if you use IDEs such as Zend studio).
The second grep makes sure you only get files that are currently of unknown status (ie the new ones).
awk grabs the file names.
xargs passes the file names as parameters to svn add.

You need to create an account or log in to post comments to this site.