Code Self Study Forum

Tip: how to create a global gitignore file

A quick tip for saving time with Git is to create a global .gitignore file. These instructions should work for Linux or Mac.

Step 1

Open a terminal.

Step 2

Type this command:

$ touch ~/.gitignore_global

Step 3

Add your global gitignore rules to that file.

Examples:

*.sw[op]
*~
tags
tags.*

node_modules/
__pycache__/

Step 4

Run this command:

$ git config --global core.excludesfile ~/.gitignore_global