sync svn working copy and remote repository (auto adding new files)

svn status | grep '^?' | awk '{ print $2; }' | xargs svn add
Lists the local files that are not present in the remote repository (lines beginning with ?) and add them.
Sample Output
$ svn status | grep '^?'
?      INFO
?      src/svn-commit.tmp
?      src/game/
?      src/game/character/

$ svn status | grep '^?' | awk '{ print $2; }' | xargs svn add
$ svn ci

A      INFO
A      src/svn-commit.tmp
A      src/game/
A      src/game/character/

2009-04-10 21:55:37

These Might Interest You

  • Copy changed files from remote git repository, _including binary ones_, staged and unstaged alike. Note that this command doesn't handle deleted files properly.

    ssh HOST '(cd REPO_DIR && git diff --name-only HEAD | cpio -o -Hnewc --quiet)' | cpio -iduv --quiet -Hnewc
    ivan4th · 2014-02-01 18:40:31 0
  • If (when) you forget to "svn rm" files from your repository, use this to let your repository know you want those files gone. Of course this works with adding and reverting too.

    svn rm `svn status | grep "\!" | cut -c 8-`
    benschw · 2009-03-29 13:28:55 1
  • Checks for syntax errors in PHP files modified in current working copy of a Git repository. Show Sample Output

    git status -s | grep -o ' \S*php$' | while read f; do php -l $f; done
    ruslan · 2013-12-14 11:47:54 0
  • These part of the command: svn status | grep '^\?' => find new file or directory on working copy sed -e 's/^\?//g' => remove "^" character on the first character of file name xargs svn add => add file to subversion repository You can modify above command to other circumtances, like revert addition files or commit files that have been modified. ^_^

    svn status | grep '^\?' | sed -e 's/^\?//g' | xargs svn add
    dollyaswin · 2009-02-28 03:00:28 4

What Others Think

svn add --force .
daithif · 479 weeks and 6 days ago
don't grep+awk awk ' /^?/ {print $2;}'
ioggstream · 468 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: