I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN?
I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN?
Set the svn:ignore property of the parent directory:
svn propset svn:ignore dirname .
If you have multiple things to ignore, separate by newlines in the property value. In that case it's easier to edit the property value using an external editor:
svn propedit svn:ignore .
Here's an example directory structure:
\project
\source
\cache
\other
When in project you see that your cache directory is not added and shows up as such.
> svn status
M source
? cache
To set the ignore property, do
svn propset svn:ignore cache .
where svn:ignore is the name of the property you're setting, cache is the value of the property, and . is the directory you're setting this property on. It should be the parent directory of the cache directory that needs the property.
To check what properties are set:
> svn proplist
Properties on '.':
svn:ignore
To see the value of svn:ignore:
> svn propget svn:ignore
cache
To delete properties previously set:
svn propdel svn:ignore
Important to mention:
On the commandline you can't use
svn add *
This will also add the ignored files, because the command line expands * and therefore svn add believes that you want all files to be added. Therefore use this instead:
svn add --force .
To expand slightly, if you're doing this with the svn command-line tool, you want to type:
svn propedit svn:ignore path/to/dir
which will open your text-editor of choice, then type '*' to ignore everything inside it, and save+quit - this will include the directory itself in svn, but ignore all the files inside it, to ignore the directory, use the path of the parent, and then type the name of the directory in the file. After saving, run an update ('svn up'), and then check in the appropriate path.
Set the svn:ignore property on the parent directory:
$ cd parentdir
$ svn ps svn:ignore . 'cachedir'
This will overwrite any current value of svn:ignore. You an edit the value with:
$ svn pe svn:ignore .
Which will open your editor. You can add multiple patterns, one per line.
You can view the current value with:
$ svn pg svn:ignore .
If you are using a GUI there should be a menu option to do this.
If you are using the particular SVN client TortoiseSVN, then on commit, you have the option of right clicking items and selecting "Add to ignore list".
If your project directory is named /Project, and your cache directory is named /Project/Cache, then you need to set a subversion property on /Project. The property name should be "svn:ignore" and the property value should be "Cache".
Refer to this page in the Subversion manual for more on properties.
Jason's answer will do the trick. However, instead of setting svn:ignore to "." on the cache directory, you may want to include "cache" in the parent directory's svn:ignore property, in case the cache directory is not always present. I do this on a number of "throwaway" folders.
If you are using a frontend for SVN like TortoiseSVN, or some sort of IDE integration, there should also be an ignore option in the same menu are as the commit/add operation.
Set the svn:ignore property. Most UI svn tools have a way to do this as well as the command line discussion in the link.