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 am using Vers
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.
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.
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".
TO KEEP DIRECTORIES THAT SVN WILL IGNORE:
svn delete --keep-local path/directory_to_keep/*
svn propset svn:ignore "*" path/directory_to_keep
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.
I had problems getting nested directories to be ignored; the top directory I wanted to ignore wouldn't show with 'svn status' but all the subdirs did. This is probably self-evident to everyone else, but I thought I'd share it:
EXAMPLE:
/trunk
/trunk/cache
/trunk/cache/subdir1
/trunk/cache/subdir2
cd /trunk
svn ps svn:ignore . /cache
cd /trunk/cache
svn ps svn:ignore . *
svn ci