The question as I understand it was: How to easily ignore all occurrences of . (Even though I upvoted your comment since I think it's insightful.) If we do global, then every mac user needs to do that, but only once.
DS_Store in all subdirectories without manually doing this in every subdirectory. The below answer shows how to solve it (the last 2 paragraphs). If we do repository wide, then we need to do that for every repository.
DS_Store files off of external and shared network volumes, too!
It is created and maintained by the Finder application in every folder, and has functions similar to the file in Microsoft Windows. DS_Store is created in any directory (folder) accessed by the Finder application, even on remote file systems mounted from servers that share files (for example, via Server Message Block (SMB) protocol or the Apple Filing Protocol (AFP)).
DS_Store files are automatically created by Mac OS X Finder in browsed directories.
DS_Store files don't add anything of value to my code (they just tell Mac OS X about folder display and icons), so I always end up adding them to my own projects' killing your commit momentum!
[Update: @applemachome told me about a for-pay app, Blue Harvest, that should help with this problem in a more general fashion (it can keep pesky .
Alternatively, you could use this utility which will redirect the creation of DS_Store files to a cache directory but I prefer not to install software that will consume resources whenever possible. This is a little bit more handy and easier to use instead of typing commands or executing scripts. I like to keep an clean desktop; no icons or links at all.
The link is I'm using Xtra Finder ( to toogle fast between hidden files. For the desktop annoying problem, my simple solution is hide the file behind the dock, you can change momentary the dock position and put the file where will remain invisible.