.gitexcludes
Setting up a .gitexcludes
file means you'll never accidentally commit something you didn't intend to, just like a .gitignore
file, but for all your local repositories.
Create your excludes file
touch ~/.gitexcludes
Add some useful ignores
._*
.DS_Store
.AppleDouble
Thumbs.db
*.sublime-*
TODO
TEMP_*
.srvr*
(follows the same format as .gitignore
)
Update git's config
git config --global core.excludesfile ~/.gitexcludes
And we're done!
Enjoy never again being the one who added all those pesky .DS_Store files to the repo!
Written by Magnus Dahlstrand
Related protips
6 Responses

Might want to add .*.sw[op]
for temporary Vim files.

I didn't know about this, NICE!

Great tip, as for vim swap files? I'd just disable them in vim, I've never had to use em

Oh, nice tip. I'm surprised why is it not named something like global_gitignore maybe.

https://github.com/github/gitignore provides a whole bunch of sample ignore files.
For instance:
cd $HOME/workspace/
git clone https://github.com/github/gitignore.git
git config --global core.excludesfile $HOME/workspace/gitignore/Global/Eclipse.gitignore

good advice, I recommend keeping it