This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Re:Questions: svn add (and svn move)

Posted by: kirkjobsluder on June 09, 2005 08:58 AM
Just to be clear, then: out of the box, svn will commit pretty much any and all changes I make to a directory, including adding files. It's only if I twiddle with it that I really need to use svn add so that I can make sure that svn only grabs the files I want it to during commit, right?

Ok, this is one of those mildly annoying things about subversion.

<tt>svn add foo/</tt>

will add:
<tt>foo/bar.txt</tt>
<tt>foo/bar.txt~</tt>
<tt>foo/code.c</tt>
<tt>foo/code.o</tt>

However, you must explicitly add new files into the directory.

<tt>touch foo/baz.txt</tt>

Won't add baz.txt to the directory. You need to explicitly do:

<tt>svn add foo/baz.txt;svn commit</tt>

to add it.

Generally, this is a good thing because you don't want generated files to be added to the repository when you do a commit.

So to summarize, when you <tt>svn add</tt> a directory, you add everything in the directory. When you <tt>svn commit</tt> a directory, you only commit the files that had been previously added.

#

Return to Version control for non-programmers with Subversion