Utilumo
LightDarkSystem

Updated June 29, 2026

.gitignore patterns reference

A .gitignore file tells Git which files to leave untracked. Patterns match by name, path, and wildcards. Copy any pattern or the starter block below.

Syntax

PatternWhat it ignores
*.logEvery file ending in .log.
build/A directory named build and its contents.
/secret.txtsecret.txt only in the repo root.
**/tempA temp folder at any depth.
!keep.logNegation: do not ignore keep.log.
# commentA comment line, ignored by Git.

Commonly ignored

PatternWhat it ignores
node_modules/Installed npm dependencies.
.envEnvironment files with secrets.
dist/Build output.
.DS_StoremacOS folder metadata.
*.tmpTemporary files.
.idea/JetBrains IDE settings.
.vscode/VS Code workspace settings.
coverage/Test coverage reports.

Snippet: a Node starter .gitignore

A reasonable starting point for a Node or web project.

node_modules/
dist/
build/
coverage/
.env
.env.local
.DS_Store
*.log
Already-tracked files keep being trackedAdding a pattern does not untrack a file Git already knows about. Run git rm --cached <file> to stop tracking it, then commit.

References

Questions

Why is node_modules still tracked after I added it to .gitignore?

gitignore only affects untracked files. If node_modules was already committed, remove it from the index with git rm -r --cached node_modules and commit the change.

How do I ignore everything except one file?

Ignore broadly, then re-include with a negation. For example, * on one line and !keep.txt on the next keeps only keep.txt.