·

It could be valuable to have a global gitignore file that you fall back on in case you don’t have one for every project.

1. Open your terminal and check if you have a global git config file set up by the following command:

git config --get core.excludesfile

2. Create a global gitignore file. You can name it anything. I call mine .gitignore__global.

3. Configure git by setting up the path for the global gitignore file you just created. I keep mine in a .dotfiles folder under my user. So in my case I do:

git config --global core.excludesFile '~/.dotfiles/.gitignore__global';

4. Now you can fill your new ignore file with anything you want ignored by default. Here’s how my global gitignore file looks like. It’s a good default for when I haven’t one set up for a project.