.gitignore generator and tester
Tick the languages, tools and operating systems in your project to get a combined, de-duplicated .gitignore. Then paste file paths to see whether git would ignore them and which pattern decides, like git check-ignore -v.
🔒 Runs entirely in your browser. Nothing you paste is uploaded or sent to a server.
1. Pick your stack
2. Test it: is this path ignored? (checks the .gitignore above, edit it freely)
Pattern rules (what the tester implements)
| Pattern | Matches |
|---|---|
*.log |
any file or folder ending in .log, at any depth (no slash means "match the name anywhere") |
build/ |
a directory named build anywhere, plus everything inside it, but not a file called build |
/todo.txt |
only todo.txt at the repository root (a leading slash anchors the pattern) |
docs/*.md |
.md files directly in docs/, not in docs/api/ (a slash in the middle also anchors) |
**/temp |
temp at any depth; logs/** = everything inside logs; a/**/b = a/b, a/x/b, a/x/y/b |
!keep.log |
re-include something an earlier pattern excluded (the last matching line wins) |
\#file, \!file |
a name that really starts with # or ! |
The tester was checked against git ls-files --ignored and git check-ignore on more than a hundred paths.
Why is my .gitignore not working?
- The file is already tracked. .gitignore only affects untracked files. Stop tracking it but keep the local copy with
git rm --cached path(add-rfor a folder) and commit. - A parent directory is excluded.
!cannot re-include a file inside an ignored directory, because git never looks inside it. Writedir/*and!dir/keep.txtinstead ofdir/and!dir/keep.txt. - Trailing spaces or a BOM.
*.logwith a trailing space does not matcha.log. Windows editors sometimes save the file as UTF-16, which git cannot read. - Wrong place. Patterns are relative to the folder the .gitignore lives in. Machine-specific junk (
.DS_Store, IDE folders) can also go in a global file:git config --global core.excludesFile ~/.gitignore_global.
Ignore node_modules/, build output, large binaries and .env files before the first commit. Committing them is how people end up with GH001: large files detected or GH013 secret-scanning rejections, and removing them later means rewriting history.
Last updated 2026-11-20.