I'm looking for a good way to automatically 'svn add' all unversioned files in a working copy to my SVN repository.
I have a live server that can create a few files that should be under source control. I would like to have a short script that I can run to automatically add these, instead of going through and adding them one at a time.
My server is running Windows Server 2003 so a Unix solution won't work.
To add an existing file to a Subversion repository and put it under revision control, change to the directory with its working copy and run the following command: svn add file… Similarly, to add a directory and all files that are in it, type: svn add directory…
svn add --force . will add all the files and directories below your current working directory that aren't added yet (and aren't ignored) to your working copy. A svn ci -m "" will then handle the commit. The only way without 'svn add' would be to use 'svn import', but this assumes a new location.
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.
Use a changeset. You can add as many files as you like to the changeset, all at once, or over several commands; and then commit them all in one go. svnbook.red-bean.com/en/1.6/svn.advanced.changelists.html -- The svn keyword is "changelist", which is addressed in the first answer and most upvoted.
svn add --force * --auto-props --parents --depth infinity -q
Great tip! One remark: my Eclipse adds new files to the ignore list automatically. It may be a matter of configuration, but anyhow: there is the --no-ignore
option that helps.
After this, you can commit:
svn commit -m 'Adding a file'
This is a different question to mine but there is an answer there that belongs on this question:
svn status | grep '?' | sed 's/^.* /svn add /' | bash
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