Social Media
More About This Website

My name is Wayne Robinson and I'm a web applications developer from Queensland, Australia. In August 2005 I discovered Ruby on Rails and instantly fell in love. From that point forward, Ruby on Rails has been my language of choice for new projects however, I still use PHP to maintain some legacy applications.

« ActiveRecord and programmatically working with attributes. | Main | TIBCO General Interface »

Add all non-versioned controlled files to the subversion repository

Just wrote a small one-liner to add all non-version controlled files in the current path and down to a subversion repository without any unecessary warning messages or errors.

svn st | \
  grep -E "^\?" | \
  sed -e s/^\?\\s*//g | \
  sed -e s/\\s/\\\\\ /g | \
  xargs -I{} svn add {}

I have only tested this on Cygwin so far, but it should work fine on Linux and Mac OS X.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (2)

svn sta | egrep '^\?' | awk '{print $2}' | xargs svn add
February 17, 2007 | Unregistered CommenterBrian
The reason for the extra sed is because I've been dealing with filenames that have spaces in them. Doing a plain awk '{print $2}' will ignore everything after the first space in the filename.
February 17, 2007 | Unregistered CommenterWayne Robinson

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Hyperlinks will be created for URLs automatically.