Marty Wallace
Marty Wallace

Reputation: 35796

Simple command to add directory and all files under into svn

Is there a simple command to add a directory and all files underneath it to svn?

I have tried svn add directory which makes sense to me but this doesn’t work as expected. I have googled it and there are solutions which all appear a bit long-winded for something so simple.

What would be the standard way of doing this?

Upvotes: 1

Views: 2899

Answers (3)

Greg
Greg

Reputation: 10360

svn add folder will add the folder and its contents. How doesn't it work as you expect?

Upvotes: 0

Maria Zverina
Maria Zverina

Reputation: 11173

svn add directory only works if the directory hasn't been added already. Adding all new files is not standard operation in svn world. Git does this but that's sidetracking.

You can often get by with svn add directory/* but it misses new files in existing subdirectory. So:

  • directory/newDirectory/file -> is added
  • directory/oldDirectory/file -> is NOT added

If you really need to add any file anywhere in the directory hierarchy this one liner will set-up an alias for you to do this:

alias svn_addall="svn st|grep ^?|sed 's/./svn add/'|sh"

Put it into your .profile and you'll have easy access to it any time. :-)

Upvotes: 2

Larusso
Larusso

Reputation: 1151

Funny. Which version of svn are you using. I`m on a mac and use svn 1.6. And it works for me. When i look at my man pages for svn then it looks like the command is recursive by default. You can permit the behaviour with:

--depth ARG              : limit operation by depth ARG ('empty', 'files',
                        'immediates', or 'infinity')

Upvotes: 0

Related Questions