Ignoring Files in Subversion – The Easy Way
I always have an extremely challenging time trying to ignore files in a Subversion repository. It must be that I just don’t get it. To me, there should only be one parameter for ignoring a file, the file itself. That’s not how SVN properties work, though.
A typical command for ignoring a file in SVN is:
svn propset svn:ignore <pattern> <directory>
So, in Drupal, to ignore your settings.php file, you navigate to the sites/default directory and run this command:
svn propset svn:ignore "settings.php" .
For some reason, this never works for me. I end up creating a slew of properties all over the repository and none of my files are ignored in version control or removed from the svn status list. This is where svn propedit comes into play.
svn propedit svn:ignore .
svn propedit lets you edit a file that contains ignore patterns for the directory you specify as the last argument in the svn propedit command.
For example, in your sites/ folder of your Drupal installation run this command:
svn propedit svn:ignore default/
Then, enter ‘settings.php’ into the file, save and exit the file.
For some reason, to me this seems like a much clearer approach to ignoring files. It worked for me…once…I haven’t been able to duplicate it.
To see all of the ignore properties in your project, navigate to the root directory of your project and run the svn propget command like this:
svn pg -R svn:ignore .
The Bottom Line
So, what does this all come down to? Instead of using SVN for your version control, use Git and forget about keeping track of directories and starting thinking of your files. If you can explain the svn:ignore property to me beyond what I’ve laid out here, please comment and educate me on setting properties on directories.