Thursday, March 5, 2009

git style ignores with svn

Ignoring files with svn sucks. I love git's simple solution that allows you to have one file called .gitignore with newline separated patterns that are parsed as ignore rules. Here's a sample .gitignore file that I use with rails applications:

config/application_settings.yml
config/database.yml
db/*.sqlite3
log/*.log
tmp/*

You can do something similar with svn by running a command like:

svn propset svn:ignore -f some_file.txt .

but you can't specify rules on any nested directories like tmp/*. In order to do that, you'd have to run another command:

svn propset svn:ignore '*' tmp/

I got tired of all that nonsense and decided to make a script that can parse .gitignore style files and properly set the correct subversion ignore rules for them. You can get the script and read more about it here: http://github.com/shuber/svnignore