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?
Edit: Using Versions and TextMate on OSX and commandline
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?
Edit: Using Versions and TextMate on OSX and commandline
Set the svn:ignore
property of the 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 .
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 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.
Gilean, are you using a particular SVN client (i.e. tortoise)? In the tortoise client, on commit, you have the option of right clicking items and selecting "Add to ignore list". The answer here depends on how you access your SVN repository.
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.
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.
here's an example directory structure:
\project
\source
\cache
\other
when in project
you see that your cache dir is not added and shows up as such
> svn st
M source
? cache
to set the ignore property
> 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
Important to mention:
On the Commandline you can't use
svn add *
this will also add the ignored files, because the Commandline expands * and though, each file is given on the Commandline. svn add believes that you would explicitly add those file. Therefore use
svn add --force .
Since I spent a while trying to get this to work, it should be noted that if the files already exist in svn, you need to svn delete them, and then edit the svn:ignore property.
I know that seems obvious, but they kept showing up as ? in my svn status list, when I thought it would just ignore them locally.
hi, how do i ignore a specific directory during runtime.
say checkout is
test->dirs->dir1 ->dir2 ->dir3
now i want to checkout and I want to ignore directory dir3 which is insie dir, during runtime of checkout
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