Git Reference
Git Reference / .gitignore

21.gitignore

Pattern syntax

One pattern per line.

# comments start with #
node_modules/      # a directory anywhere
*.log              # by extension
/build             # only at repo root
docs/**/*.pdf      # any depth
!important.log     # re-include
.env*

Debug & scope

Why is this file ignored?

git check-ignore -v path/to/file
git status --ignored
# personal, unshared ignores:
echo "scratch/" >> .git/info/exclude
git config --global core.excludesFile ~/.gitignore_global