How to use the .gitignore Generator
- Pick everything your project uses — a language, a framework, your operating system and your editor. Or start with a preset.
- Use the filter to find templates quickly (“next”, “jet”, “docker”).
- Add project-specific paths in Your own rules; they’re appended at the end so they can override earlier rules with
!. - Download the file, save it as
.gitignorein the root of your repository and commit it.
What belongs in a .gitignore?
Everything that is generated, machine-specific or secret: dependency folders (node_modules/, .venv/), build output (dist/, .next/), caches, logs, editor settings and .env files with credentials. Source code, lock files and configuration your team shares stay in Git.
| Pattern | Matches |
|---|---|
node_modules/ | The folder anywhere in the repo (trailing slash = directories only) |
/dist | Only dist in the repository root (leading slash anchors it) |
*.log | Every file ending in .log, in any folder |
**/temp | temp at any depth |
!.env.example | Re-includes a file that an earlier rule ignored |
# comment | Ignored line — use it for section headers |
Already committed a file you now want to ignore?
A .gitignore only affects untracked files. To stop tracking something that is already in the repository, run git rm --cached path/to/file and commit — the Git Command Generator builds the exact command. If you committed a secret, rotate it: removing it from the latest commit doesn’t remove it from history. Check your env files with the .env File Validator.
Project vs global ignore
OS and editor files (.DS_Store, Thumbs.db, .idea/) can also go into a global ignore file on your own machine: git config --global core.excludesFile ~/.gitignore_global. Many teams still add them to the project file so nobody commits them by accident. Pair your ignore file with an .editorconfig and a README when starting a new repository.
Tools that pair well with the .gitignore Generator
- package.json Generator — Fill in a form and get a valid package.json — npm name validation, script presets for Vite, Next.js, Node and TypeScript libraries, exports, engines, license and repository — with warnings for common mistakes.
- GitHub Actions Workflow Generator — Choose your stack, triggers and steps and get a commented .github/workflows/ci.yml — install, cache, lint, test, build, a version matrix and optional deploy to GitHub Pages, Vercel or a container registry.
- Semantic Version Calculator — Everything about semantic versions in one place: compare two versions, calculate the next major/minor/patch/prerelease, and see exactly which versions an npm range like ^1.2.0 or ~2.3 allows — explained in plain English.
- Changelog Generator — Paste your git log and get a tidy CHANGELOG.md section: commits grouped into Features, Bug Fixes, Performance and Breaking Changes, scopes in bold, links to commits — plus the next semantic version.
Frequently asked questions
Where do I put the .gitignore file?
.gitignore. You can add more .gitignore files in subfolders; their rules apply relative to that folder.Why is a file still tracked after I added it to .gitignore?
git rm --cached <file> (add -r for folders), then commit. The file stays on your disk.Should I commit package-lock.json or yarn.lock?
Should .env be in .gitignore?
.env and .env.*.local, but commit a .env.example with the variable names and no real values so teammates know what to set.