Ignoring Files in a Subversion Repository


Oftentimes, with Subversion it’s pretty handy to ignore the status of files in your working copy. Cache files or other auto-generated data files can quickly become a pain to other users of your repository.

If you’re using SASS for example, that creates a lot of cache files in the .sass-cache folder that can take a long time to checkout and generally make the place look untidy especially when you’re viewing your svn status.

Git has the useful .gitignore file, but you can do the same tricks with Subversion it’s just not quite so obvious.

You’ve got a few options with Subversion on how you go about doing this, so you’ll have to decide which one is most suitable for your project.

The Global Ignore

The first and probably the one you will use least is the global-ignores option. You can use this option to ignore files across all your project locally without additional setup for new projects.

This is only really useful if you are certain a particular type of file is common throughout, for example the .DS_Store file on Mac (this is already included in the global-ignores by default) or other system generated files.

Subversion global settings files are located in ~/.subversion on Mac, /etc/subversion on Linux and %appdata%\subversion on Windows machines.

The file you want to edit is config.

Open it up in your editor and scroll down to the section headed [miscellany]. You’re looking for the line beginning # global-ignores =.

Remove the hash and add whatever filename expressions you like. Again, this is only a good idea if you’re sure these file types are so dull and unimportant to your projects that you never want to see them again.

You can’t share these settings as part of your Subversion repository so you’re team won’t know you’ve done it unless you tell them. If you need your svn ignore options present in your repository the next options should suffice.

Svn Property svn:ignore

Svn applies properties to files. To interact with these properties you need the commands, propset, propget, propedit and proplist.

For this example we want to ignore the .sass-cache directory in our project, so lets say that you made a couple of changes to your css files with sass and you run svn status and you get.


If you add the .sass-cache file by accident you’ll be picking .sass-cache files out of your repository for a while and that’s a pain. So to set the svn:ignore option use.


To check the property you’ve just set use.


Or to list all the properties you currently have set on the current directory along with their values use:

Ignoring Multiple Files

If you need to ignore multiple files use a whitespace-delimited list as the property.

Once you’ve verified your svn:ignore values go back and check your svn status

You’ll see that the .sass-cache files have now vanished from the list, which should prevent them from being accidentally versioned. If you want to view them again, simply use svn status --no-ignore.

You’ll also notice that the directory we applied the new property to has been modified. All properties are kept under version control so you’ll need to remember to svn commit the file you applied the property to.

Using a File for Ignore Values

The only minor drawback I find with the above method is the lack of visibility it provides. Unless you explicitly check for the existence of properties on a file there’s nothing to tell you they are there.

To get around this I prefer to use a file for my svn:ignore settings to emulate the helpful way that Git does it.

Create a new file named .svnignore containing your whitespace delimited list of files which must be ignored.

Then run the command:

This should make it easier for you or anyone else with a working copy of your project to see what’s going on.

Leave a Reply

Your email address will not be published. Required fields are marked *