Configure git to globally ignore some files
If you think about it, there are always going to be some files you don’t care about keeping under version control. Immediately come to my mind are:
- .DS_Store
- vim swap files
Why should you always add these to your project’s .gitignore? The answer is, you shouldn’t, and you don’t need to.
Try this. Toss the following in ~/.gitignore
:
.DS\_Store
*.sw?
Now run this:
$ git config --global core.excludesfile ~/.gitignore
Good job! Now .DS_Store and vim swap files will always be ignored.
Found this gem in the PeepCode Google Group.