.gitignore operating system files

Posted 02 September 2013 - 12:35 AM

There are at least two places you can tell Git to ignore files and folders. Each project has its own .gitignore file but there is also a global .gitignore. Conventional wisdom is that unwanted files that are operating system specific or editor specific go in the global one (because they are specific to my machine's setup) and unwanted files specific to the project and language go in the project one.

Let's say I'm developing Java with Eclipse on Windows. Following conventional logic, the Java undesirables would go in the project's configuration but the Eclipse and Windows ones go in the Global one.

So far so good, but there is a good chance collaborators will use Windows and/or Eclipse. Should I trust them to set up their global .gitigore? Perhaps they have other projects that make some of those global settings unsuitable. Wouldn't it be safer to put them all in the project .gitignore? I could throw in Netbeans, IntelliJ, vim, Sublime Text and Linux. If someone comes in with a different setup, the appropriate .gitignore patterns could be added to the project.

Or is there something I've missed? When I disagree with conventional wisdom, there is usually an important aspect I've missed.