I freaking hate
DS.Store files. I had to add them to every project's
.gitignore. Today I got sick of it and did some research (read: "spent 5 seconds googling").
Turns out, it is possible to have a global gitignore file.
Create the file somewhere (it doesn't matter). I put mine into
git config --global core.excludesfile ~/.gitignore-global
Add some common exclusions there. Check out a big list of those on Github:help.
One note on the list: I personally don't feel like putting
.gitignore-global. Sometimes you will actually need
.log files in your repo.
What you won't need, however, are these freaking
DS.Store files. Them and their brothers from other operating systems. So it's safe to ignore them globally.
As a result, I ended up with this
.DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db
That's it, you are set for life.
You're the 1291st person to read this article.