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
Bash oneliner for multiple ignores:
svn propset svn:ignore ".project"$'\n'".settings"$'\n'".buildpath" "yourpath"
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 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 .
"Thank-you" svn for such a hideous, bogus and difficult way to ignore files.
So I wrote a script svn-ignore-all:
#!/bin/sh
# svn-ignore-all
# usage:
# 1. run svn status to see what is going on at each step
# 2. add or commit all files that you DO want to have in svn
# 3. remove any random files that you don't want to svn:ignore
# 4. run this script to svn:ignore everything marked '?' in output of `svn status`
svn status |
grep '^?' |
sed 's/^? *//' |
while read f; do
d=`dirname "$f"`
b=`basename "$f"`
ignore=`svn propget svn:ignore "$d"`
if [ -n "$ignore" ]; then
ignore="$ignore
"
fi
ignore="$ignore$b"
svn propset svn:ignore "$ignore" "$d"
done
Also, to ignore specific list of files / pathnames, we can use this variant svn-ignore. I guess svn-ignore-all should really be like xargs svn-ignore.
#!/bin/sh
# svn-ignore
# usage:
# svn-ignore file/to/ignore ...
for f; do
d=`dirname "$f"`
b=`basename "$f"`
ignore=`svn propget svn:ignore "$d"`
if [ -n "$ignore" ]; then
ignore="$ignore
"
fi
ignore="$ignore$b"
svn propset svn:ignore "$ignore" "$d"
done
One more thing: I tend to pollute my svn checkouts with many random files. When it's time to commit, I move those files into an 'old' subdirectory, and tell svn to ignore 'old'.
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.
Since you're using Versions it's actually really easy: