Git: ignore helper files system-wide

If you're working on a project with a team but you don't want to clutter up the .gitignore file, or the commit history with a bunch of helper files from your file manager, text editor, or IDE then you can run this to ignore them in any projects on your system:

$ git config --global core.excludesfile ~/.gitignore
$ echo -e ".DS_Store\n.idea\n*.swp" >> ~/.gitignore

I've added ignores for OS X's metadata files (.DS_Store), PyCharm's helpers (.idea) and Vim's swap files (.swp) as an example.