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 with Google, I have been unable to work out how to automatically add all unversioned files in the working copy to the repository before the commit.
Does anyone know how I might go about doing this?
Kindness and thanks in advance,
Dan
Edit These files exist in a directory tree so adding * for one directory will not work. @your edit: So then provide multiple paths to add like: svn add dir1/* dir2/* dir3/* or as many have mentioned grep the ouput of svn stat from the root and pipe it to cut or awk and then to add.
Right Click the new repo and choose SVN Repo Browser. Right click 'trunk' Choose ADD Folder... and point to your folder structure of your project in development. Click OK and SVN will ADD your folder structure in.
For Macs: If you are using a command line client on your Mac, simply drag the files (and directories, if applicable) into your repository structure (whether it's empty or not) and then use the "svn add" command to convert your file or directory into a versioned file as a part of your SVN repository.
svn --force --depth infinity add .
Be careful, though, because this will also add any svn:ignore
'd files.
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.
Try this one on for size - much more elegant than forcing through an svn add:
$ svn add `svn status|grep '\?'|awk '{print $2}'`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With