Ignore Files and Directories in Subversion (SVN)

2b19db1dbb4f22f7a4f08fbaf79f68084f0a1dc0

Thu Apr 08 10:21:10 2010 -0700

Subversion is fun lame. Especially when it tries to commit intermediate build files and other junk you want to keep out of your SVN repository. In my environment, Ant is configured to place intermediate build files into my build/ directory. The final product is then packaged up and placed into my dist/ directory. So, I need SVN to ignore everything inside of my build/ directory since the contents of this folder are going to change on every build.

Meet svn propedit svn:ignore:

#/> svn propedit svn:ignore build
#/> svn -m "ignoring build" commit build

When you run svn propedit, your local text editor will open (usually vi) which will allow you to specify a series of file names to ignore under build/. If you want to ignore all files and folders, just enter a single * wildcard character, save, and commit:

*

Or, maybe you want to ignore just .class files:

*.class

Of course, if you want to use another editor like emacs to set your ignore properties, you can do so by exporting SVN_EDITOR before running svn propedit:

#/> export SVN_EDITOR=emacs

Cheers.

svn