Global .gitignore file

This is so simple I wish I knew it before. In every git project, there seems to be a set of local files that always get added to the .gitignore file. For example, PHPStorm users always get an .idea file added for every project they create. Another prime example is the darn .DS_Store file that always sneaks up. To limit the common headaches, there’s a global way so git ignores all of those files so you don’t accidentally mark those for revisioning again!

First off, create a global .gitignore__global file (or whatever you want to call it) in an easy place to remember. For me on the mac, I put it in the users folder (~/). Edit the new file and list the files you want to ignore globally. Save the file. Lastly, tell git to use this setting by running this command:

# Make sure to update the last bit to point to where you saved the file and what you named it.
git config --global core.excludesfile ~/.gitignore__global

And there ya go! No more .idea or .DS_store files will appear when you run git status.