paul bennett

Setting and updating svn:ignore

Posted on: April 21, 2010

I’ve found the command line to be the most reliable and simplest way of managing subversion repositories, but also found the svn:ignore property a little more esoteric to set up than I’d like.

svn:ignore is used to specifiy files and folders you don’t want to be part of the version controlled repository for your site or application build. These often include location specific settings files, development or debugging files etc.

For the benefit of others, here’s my run down to getting this working for my user account on a CentOS server.

1. Set up your default text editor for SVN

First, make sure you have a default text editor set up for subversion. The first time svn runs it builds a config directory, which on a linux server, is a directory named ‘.subversion‘ in your home directory.

Navigate into the .subversion directory (/home/youruseraccount/.subversion) and edit the config file. Uncomment the editor-cmd line and add in the name of the editor you’ll be using (in CentOS it’s nano).

Save your changes and then navigate to the directory where your repository resides.

2. Check which files and folders currently aren’t under version control

You can easily see what files aren’t under version control by running

svn status

and looking for the lines prefixed with a ‘?‘.

3. Add exclusion patterns for files and folders

Add svn:ignore properties for the files and / or folders you want subversion to ignore by running the folling command:

svn propedit svn:ignore directory-name

where directory-name is the directory you want to apply the changes to.

This should open the :ignore properties file in the text editor you specified. You can then enter file and folder names and / or patterns you want ignored. Once you’ve saved the changes, run

svn ci

to check in the property changes.

Now if you run

svn status

the file and folders you specified to ignore won’t be listed and won’t be under version control. Voila!

Further resources:

Leave a comment

Archives