global gitignore

Global Git Ignore

A global Git ignore file is a machine-wide ignore list. Use it for files that are personal editor, OS, or tool noise, and that should not be tracked in any project you work on.

This is different from a project .gitignore. A project .gitignore belongs to the repository and documents files everyone on the project should ignore. A global ignore belongs to your machine and is for your personal environment.

Set One Up

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

Add ignore patterns to ~/.gitignore_global. For example:

# Vim swap files
*.swp
*.swo
*.swx
.*.sw?

Check It

git config --global --get core.excludesfile

Global ignores only affect untracked files. If a file is already tracked, Git will keep tracking it until you remove it from the index with git rm --cached.


edit this page