| TortoiseSVN Global Ignore Pattern vs. svn:ignore |
| Thursday, December 04 2008 |
|
When using a source control system, there are certain files and folders you normally want to exclude from source control. For instance, on projects developed with Visual Studio, you almost never want to check-in your bin and obj folders, nor should you ever check-in any .user or .suo files.
If you use the TortoiseSVN-Subversion combo, you have a couple ways to exclude files and folders from source control:
- By setting the svn:ignore property on the relevant files and folders, or
- By using the Global Ignore Pattern setting in TortoiseSVN
Using the svn:ignore Property
Let's look at the svn:ignore property first because I'm willing to bet that many people set this property without actually realizing it. With TortoiseSVN, it's really easy to exclude an item from Subversion source control by right-clicking on it, going to TortoiseSVN, and selecting "Add to ignore list".
That's simple enough, but you have to do this for each and every file/folder you wish to exclude, which can be tedious. But what's really happening is that TortoiseSVN is setting a svn:ignore property on the parent folder of the item being excluded, which will get committed for that folder on the Subversion server side during your next check-in.
For example, in my main Trunk folder I want to exclude a folder named Temp from source control, so I right-click it, go to TortoiseSVN, and select "Add to ignore list". To see the effect, I right-click on Trunk (the parent folder of Temp), go to TortoiseSVN, select Properties, and see this:
![]() |
Before I added Temp to the ignore list, this box was empty, and now this change will get committed in Subversion and everyone else on my team will pick up the change the next time they get latest, which may or may not be the desired effect.
Using the TortoiseSVN Global Ignore Pattern
That's all well and good, but like I said, it can be tedious to do that for every item you wish to exclude from source control. Another way to accomplish the same thing is to use the Global Ignore Pattern in your TortoiseSVN settings. To do this, right-click on the root folder of your local repository, go to TortoiseSVN, and select Settings (notice I said Settings, not Properties). This is what you'll see:
![]() |
It's here that you can enter any item you wish to ignore, and TortoiseSVN will save them in your local settings without ever adding svn:ignore properties to anything.



10 comment(s) so far
You can also set the "global-ignores" property in the Subversion config file (at C:\Users\UserName\AppData\Roaming\Subversion\config on Vista). This has the added benefit of working with the command-line SVN client as well as TortoiseSVN.
Dave, first things first... please fix the tab-order on your comment form - it seems to go Name -> Mail -> Website -> somewhere-near-the-top-of-the-page (as opposed to the Comment box).
Ok, now on to business. You are correct that the global ignore is convenient, but unfortunately its only effective on your machine. So other devs won't have the same files ignored on their boxes - nor will they be ignored in other SVN client on your box, like the terminal.
I'm sure you are well aware of this, but I thought it was worth pointing out just in case others weren't.
+1 on tabs. But for those interested here's my global ignore pattern, perhaps others would care to share theirs as well, so I can STEALS THE PRECIOUS!!!
*.resharperoptions Web_Data log */[Bb]in [Bb]in */obj obj */TestResults *.[Uu]ser
I also posted my tortoise settings global ignore pattern here...
www.mokesit.com/.../Default.aspx
Steve - I thought that was clear, but just in case, yes, using the global ignore pattern in TortoiseSVN is specific to just your machine. Thanks for reiterating.
See also changelists svnbook.red-bean.com/.../svn.advanced.ch - they're a client-only feature (unfortunately) but useful for files that you rarely want to check in (e.g. Web.config). TortoiseSVN allows you to quickly add things to the "ignore-on-commit" changelist by right clicking, so they're not selected in the commit dialog by default.
I can tell from the post that you already know this, but as an SCM weenie I feel like it should be spelled out.
If there is anything that all the people working on your project should ignore, then you must use svn:ignore. Or somehow ensure that everyone has the same Tortoise settings and only ever uses that to access svn. If you don't, you _will_ end up with crap in your repository. And that crap will either confuse someone later, or make things work when they shouldn't.
These lists that people are posting where .exe's and .dll's are only excluded by their particular client tools scare me.
@Dave,
Seeing as several others also pointed it out I'm going to say that NO, you weren't clear enough. I would suggest that next time you wave your hands in the air while screaming the warning... but we all know we wouldn't see your hands-a-waving (due to your absurdly short arms). :)
I think I'm gonna go with the TortoiseSVN Global Ignore Pattern..that way I can make the <a href="http://www.notionsolutions.com">rules/settings</a> that apply to all future files instead of having to do it for every file...if I understood it correctly!?
Links