Add all unversioned files to SVN

后端 未结 5 1466
失恋的感觉
失恋的感觉 2020-12-12 19:11

I have a working copy that gets automatically committed into SVN overnight using a script.

I use the SVN command line to do so.

After a frustrating battle wi

相关标签:
5条回答
  • 2020-12-12 19:45

    Try this one on for size - much more elegant than forcing through an svn add:

    $ svn add `svn status|grep '\?'|awk '{print $2}'`
    
    0 讨论(0)
  • 2020-12-12 19:46

    You have to call svn add in your script for each unversioned file prior to svn commit—something like this for a shell script:

    for file in `svn st | grep '^\?' | awk '{ print $2; }'`; do
        svn add $file
    done
    
    0 讨论(0)
  • 2020-12-12 19:47
    svn --force --depth infinity add .
    

    Be careful, though, because this will also add any svn:ignore'd files.

    0 讨论(0)
  • 2020-12-12 20:05

    The accepted solution

    svn --force add .

    will also add all ignored unversioned files. Most people likely prefer just to add all unversioned but not ignored files.

    To add all unversioned but not ignored files, codefox421 answer is right:

    svn st | grep '^\?' | sed 's/^\? *//' | xargs -I% svn add %

    as svn st does not show ignored files.

    0 讨论(0)
  • 2020-12-12 20:09

    In my case i need to specify :

     svn --force add dir/*/*/*
    

    * is level of tree that i want to add.

    Check the result with

    svn status --no-ignore
    
    0 讨论(0)
提交回复
热议问题