Daisy
Daisy

Reputation: 821

SVN: Recursive add

I am trying add new project files in a SVN folder from my working copy freshly. Its asking an option "Recursive" with a message "Are you sure you want to add * many items?" . Could someone guide me what is the use of this "Recursive" option to enable? Should i have enable it when i'm freshly adding new project files or not?

Thank you.

Upvotes: 41

Views: 80939

Answers (4)

ni1ight
ni1ight

Reputation: 347

First to answer your question if you should enable the recursive option: If you have copied a folder structure with multiple files and nested folders inside, the recursive add is something you need.

In command line, this should work for you:

svn add * --depth infinity

If it does not work, you can try to use the '--force' argument:

svn add * --force --depth infinity

Or, in some cases where the ignore properties are making troubles, you might also need to use '--no-ignore' to succeed:

svn add * --force --no-ignore --depth infinity

Upvotes: 10

TenG
TenG

Reputation: 4004

I had to resort to using our old friend find as follows:

cd root_folder_I_want_to_checkin

Add folders recursively:

find . -type d -exec svn add {} \;

Check status (all should show as A):

svn status

Some files still showed with status ? so I did this as well:

find . -type f -exec svn add {} \;

Now svn status shows all are A, so now:

svn commit . -m 'blah blah blah.'

Upvotes: 1

jones-chris
jones-chris

Reputation: 701

svn add * --force did not work for me when adding zip files.

Instead I had to cd to the directory containing the zip files and run svn add .

$ svn add .
A         .
A  (bin)  SOAPUI_TEST_1.zip
A  (bin)  SOAPUI_TEST_2.zip
A  (bin)  SOAPUI_TEST_3.zip
A  (bin)  SOAPUI_TEST_4.zip

Upvotes: 1

Even Cheng
Even Cheng

Reputation: 1996

Short version: svn add * --force is all you need

Long version: According to svn add manual page

Normally, the command svn add * will skip over any directories that are already under version control. Sometimes, however, you may want to add every unversioned object in your working copy, including those hiding deeper down. Passing the --force option makes svn add recurse into versioned directories:

$ svn add * --force
A         foo.c
A         somedir/bar.c
A         otherdir/docs/baz.doc

Upvotes: 95

Related Questions