svn:ignore
I found out about svn:ignore recently, and thought that I would share. The doc is here: http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.advanced.props.special.ignore
Basically, you go into the directory that you want to set up with ignores. This would be a pattern of filenames that you don’t want to ever check into svn, you want svn to ignore them. You can do this recursively by using the -R switch.
svn propedit svn:ignore . #Set up an ignores file in this directory svn -R propset svn:ignore -F svnignores.txt . #Copy the svnignores.txt file into the svn:ignores information for this directory and all contained directories recursively
Just list out what you want svn to ignore, one pattern on each line. * is wildcard.
My svn:ignore files tend to look like this:
*.pyc
*~
#*#
So, I'm ignoring compiled Python files with *.pyc, Emacs backup files with *~, and vi backup files with #*#. You can add in any other patterns you like, such as bin and eggs directories.
I heard keeping up svn:ignore can be a real PITA, so I’ve settled on just setting up global ignores in my working environment. See http://www.unc.edu/~jj/plone/ for details, including making it work in windows (no menu on my site just yet, grep for ‘Import Into Subversion’ and look at step #8)
Edit: That’s step 8
jjmojojjmojo said this on May 13, 2008 at 11:33 am |
Jjmojojjmojo: There are pros and cons to each method. I like svn:ignores because it keeps users that might not have their svn set up to ignore these files from checking them in. It is a pain, though, I admit.
If you’re just working on your own stuff, or have all the developers use the same global configuration method, the global ignores is a very nice solution, much easier to keep up.
Liz said this on May 13, 2008 at 11:49 am |
So, I said:
svn propedit svn:ignore .
and entered some ignore patterns in the text file that automatically pops up (called svn-prop.tmp by default) and saved it, and nothing seems to have changed in the svn status — files are still marked with “A”. is there something else I need to do? Thanks.
andy said this on July 14, 2008 at 6:27 am |
Andy:
Are the files that you wanted to ignore in the same directory in which you ran this command? Use the -R switch to make this work in subdirectories: svn propedit -R svn:ignore .
Liz said this on July 14, 2008 at 8:56 am |
Hmm, when I do that command I get
“Subcommand ‘propedit’ doesn’t accept option ‘-R [–recursive]'”
andy said this on July 14, 2008 at 2:25 pm |
for -F you would use svn propset (use the file specified as the value to set the property to). For recursive, you would also need to use propset. So, e.g.,
svn -R -F [apply_this_file_everywhere] propset svn:ignore .
would set the svn:ignore property to the values in the file you provide to all directories under the current working directory.
You should be careful about this though. Any directories that already have svn:ignore set will have those settings completely overwritten. So it’s best to use this when setting up a project, or on a subdirectory that has no svn:ignore settings at all recursively. I’m sure there’s some way (on Linux or *nixen) to write scripts that will edit/add patterns recursively, but I don’t need that yet, so haven’t spent any time at it yet :-).
Gerald Quimpo said this on August 12, 2008 at 5:08 pm |
Awww…
Subcommand ‘propedit’ doesn’t accept option ‘-R [–recursive]’
douglas said this on August 20, 2008 at 2:34 pm |
Oop, sorry, my mistake.
The recursive command works with propset, not propedit. I’ve edited the post to reflect this.
Liz said this on August 21, 2008 at 8:09 am |
@andy
Make sure there aren’t any spaces in the file when you use propedit.
Ben Hardy said this on July 21, 2009 at 11:49 am |
Thanks so much for this post! I knew there had to be a way to do this, but didn’t think about the propset command.
musi00e0 said this on October 10, 2009 at 11:06 pm |
Awesome, your recursive option note saved me some time.
ivan said this on August 2, 2010 at 11:44 am |
[…] For our situation, however, we need to ignore .LCK files for ALL directories within /html. Running the previous command in each directory is possible, but not very efficient. So I did some searching and found the solution here: https://athenageek.wordpress.com/2008/04/16/svnignore/ […]
Drey's Attic Blog » SVN – svn:ignore said this on April 2, 2011 at 7:06 pm |
your font is too small
Amd said this on August 1, 2012 at 2:48 pm |
Looks like it got changed on me. Thanks for pointing that out!
Liz said this on August 1, 2012 at 9:50 pm |