Glossary

.gitignore

A .gitignore file lists paths that git should ignore: files and directories that should not be tracked, not appear in git status, and not be added by git add. Typical entries include build output, editor swap files, OS metadata, secrets, and generated assets.

# Binary output
/build/
*.o
*.exe

# Dependencies
node_modules/
venv/
__pycache__/
*.pyc

# Editor files
*.swp
.idea/
.vscode/

# Secrets
.env
*.pem

Patterns follow globbing rules: * matches anything except /, ** matches any number of directories, trailing / means directory only, and leading ! re-includes a previously ignored pattern. A .gitignore in a subdirectory applies relative to that directory, composing with ones higher up.

For patterns that apply to every project—editor backup files, OS-specific cruft—use ~/.config/git/ignore (or whatever is set in core.excludesfile), the global ignore file. The service gitignore.io generates starter .gitignore files for any combination of languages, frameworks, and tools. Respecting .gitignore is one of the minimum courtesies when sharing a repository: it keeps the commit stream clean of noise.

Related terms: Git, Git Repository

Discussed in:

Also defined in: Textbook of Linux