How do I add all new files to SVN

Viewed 118897

I am using an ORM which generates large amounts of files from a CLI. Is there an easy way to run the svn add on all files within a directory which appear as ? when I run svn status?

Edit These files exist in a directory tree so adding * for one directory will not work.

15 Answers

you can just do an svn add path/to/dir/* you'll get warning about anything already in version control but it will add everything that isn't.

svn status | grep "^\?" | awk '{print $2}' | xargs svn add

Taken from somewhere on the web but I've been using it for a while and it works well.

If svn add whatever/directory/* doesn't work, you can do it the tough way:

svn st | grep ^\? | cut -c 2- | xargs svn add

You should be able to run:

svn add *

It may complain about the files that are already under version control, but it will also add the new ones.

You may want to think about whether or not you really want to add these generated files to version control, though. They could be considered derived artifacts, sort of like the compiled code, and thus shouldn't be added. Of course, this is up to you, but its something to think about.

svn add *

should do the job. Just make sure to:

svn commit

afterwards :)

On Alpine Linux OS I used this, based on others answers:

svn st | grep ^? | sed 's/? *//' | xargs -I fn svn add "fn"

In some shells like fish you can use the ** globbing to do that:

svn add **

I am a newbie to svn version control. However, for the case when people want to add files without ignoring the already set svn:ignore properties, I solved the issue as below

  1. svn add --depth empty path/to/directory
  2. Execute "svn propset svn:ignore -F ignoreList.txt --recursive" from the location where the ignoreList.txt resides. In my case this file was residing two directories above the "path/to/directory", which I wanted to add. Note that ignoreList.txt contains the file extensions I want svn to ignore, e.g. *.aux etc.
  3. svn add --force path/to/directory/.

The above steps worked.

Related