What belongs in .gitignore
A .gitignore tells Git which files never to track — keeping your repo clean, small, and secret-free. The categories every project should ignore:
| Category | Examples |
|---|---|
| Dependencies | node_modules/, vendor/, .venv/ |
| Build output | dist/, build/, *.o |
| Secrets / env | .env, *.pem, credentials.json |
| Editor / OS cruft | .vscode/, .idea/, .DS_Store |
| Logs / temp | *.log, tmp/, *.cache |
This generator assembles these from your selected stack (Node, Python, Go, Rust, Docker, and more), so you start from a sensible, comprehensive baseline.
Project vs global
Use both, for different things. A project .gitignore (committed in the repo root) holds rules everyone needs — node_modules/, dist/, .env. A global ~/.gitignore_global holds your personal editor and OS files — .DS_Store, .vscode/, .idea/ — which shouldn’t be imposed on teammates who use different tools. Keeping editor cruft in your global config keeps project .gitignore files clean and tool-agnostic.
Glob patterns in brief
.gitignore uses glob patterns: *.log matches anywhere, /build/ matches only at the repo root (leading slash), build/ matches a build directory at any depth, and !important.log re-includes a file otherwise excluded (negation). One catch: you can’t re-include a file if its parent directory is ignored — you must un-ignore the directory first. Use git check-ignore -v <file> to see exactly which rule is matching a given file when behavior surprises you.
Lockfiles: commit them
For application projects, commit your lockfile (package-lock.json, yarn.lock, pnpm-lock.yaml) — it pins exact dependency versions so every developer and CI run installs identically, preventing “works on my machine” drift. Some generated Node templates exclude lockfiles by default (a convention for published libraries, which want fresh resolution); delete those lines if you’re building an app. Pair this with the Docker Compose Builder for a complete project scaffold.