Skip to content

SVN: ignoring temporary files in Subversion

2 min read

When working on a project using SVN it can be a real pain when people commit temporary files like cache files. As soon as you attempt to merge and commit some code you find a load of unneccessary conflicts from unimportant files.

To get round this you just need to make sure you tell SVN to ignore anything that doesn't want to be version controlled. This can be achieved by running the following command replacing "./some_path" with the directory you want files ignoring in:-

svn propedit svn:ignore ./some_path

Then in the text editor you can list what you want to ignore using the wildcard *. For example to ignore all files with the extensions '.log' and '.cache' in the directory:-

*.log
*.cache

To ignore all files in the directory just simply add the wildcard:-

*

Even simpler you can just set this directly from the command line using svn propset:-

svn propset svn:ignore "*" ./some_path

Once you have saved your changes to the SVN ignore file you'll need to commit the directory it relates to for the change to come into effect.

If any unwanted files have previously been committed you'll need to remove them first before the ignore will come into play on those files.

If you do this for all directories containing temporary files future commits and merges should be a lot simpler.

© 2024 Andy Carter