Add new files to SVN from the command line

Here is a little tip for automating files that need to be added to SVN.

First make sure you are in your project folder that is under source control. Then try the following:

svn status | grep -e ^?

With this you’ll notive that it will list the files, but its not in a format ready automatable. So lets enhance it:

svn status | grep -e ^? | awk '{print $2}'

This time we get a list of the files that need to be added, but lets take it a step further and also add the files to SVN in one step:

svn add `svn status | grep -e ^? | awk '{print $2}'`

There. Now all you have to do is commit.






Leave a Reply

Your email address will not be published. Required fields are marked *