Ignoring Files in Subversion with svn:ignore

Posted by Johnny on February 5th, 2009 filed in Technology, Tips & Tricks

There may be times when you want to keep certain files out of Subversion. Examples of these include local configuration files and temporary files like those created by vim. Fortunately, Subversion has an option to specify exclusions, via svn:ignore. To do this, run the following in a terminal

svn propedit svn:ignore <parent directory of the files/directories to ignore>

This will open up a text editor where you can specify what to ignore, one file/directory per line. Remember that these are all relative to the parent directory you specified. Two things to note:

  • The command is svn propedit and not svn propset in a normal use case. The latter command is for migrating CVS ignore files, and will produce a Explicit target required error if you attempt to run it on a directory.
  • This only works for items not yet in the repository. If the file or directory was previously placed in Subversion, specifying it in the ignore file won’t have any effect.

Check out the chapter on ignoring unversioned items of the online Subversion book for more information, such as what file pattern syntax you can use in the ignore file.

Leave a Comment