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
After losing a lot of time looking for how to do this simple activity, I decided to post it was not hard to find a decent explanation.
First let the sample structure
$ svn st ? project/trunk/target ? project/trunk/myfile.x
1 – first configure the editor,in mycase vim export SVN_EDITOR=vim
2 – “svn propedit svn:ignore project/trunk/” will open a new file and you can add your files and subdirectory in us case type “target” save and close file and works
$ svn st ? project/trunk/myfile.x
thanks.
The command to ignore multiple entries is a little tricky and requires backslashes.
svn propset svn:ignore "cache\
tmp\
null\
and_so_on" .
This command will ignore anything named cache
, tmp
, null
, and and_so_on
in the current directory.
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.
If your directory foo
is already under version control, remove it first with:
svn rm --keep-local foo
svn propset svn:ignore foo .
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.
Thanks for all the contributions above. I would just like to share some additional information from my experiences while ignoring files.
When the folders are already under revision control
After svn import and svn co the files, what we usually do for the first time.
All runtime cache, attachments folders will be under version control. so, before svn ps svn:ignore, we need to delete it from the repository.
With SVN version 1.5 above we can use svn del --keep-local your_folder
,
but for an earlier version, my solution is:
.svn
hidden folder)When we need more than one folder to be ignored
svn:ignore
svn pe
will need to edit the text file, and you can use this command if required to set your text editor using vi:
export SVN_EDITOR=vi
The file looks something simply like this:
runtime
cache
attachments
assets