Build a .gitignore from 33 language, framework, OS and editor templates, remove duplicates, add your own rules and test which paths would be ignored.
One forgotten line in a .gitignore and a .env full of keys is on GitHub. Tick the parts of your project, from Node.js to Unity to macOS, and get one tidy file, with any rule that two templates share written only once.
It starts with Node.js, secrets, logs, macOS, Windows and VS Code selected. The test box beneath it holds a small project, where .env shows as ignored and .env.examplestays kept, so you can see the file working before you use it.
.gitignore in the root of your repository.The tester is the part worth trying when a file will not behave. It tells you when a file is ignored because of its folder, as in node_modules/express/index.js, which is usually why a! rule seems to do nothing.
Git reads the rules in order and the last match wins, so .env.* followed by !.env.example ignores every env file except the example. A slash at the start or in the middle ties a pattern to the repository root; without one it matches at any depth. A trailing slash matches folders only, and ** crosses folders. A file cannot be re-included if its parent folder is ignored, because git never looks inside. The tester was checked against real git check-ignore on a file tree: 67,289 path checks with no differences.
A .gitignore only affects untracked files. If a file was already committed, adding a rule does nothing until you run git rm --cached on it, and a secret that was pushed stays in history, so change the key as well. Each folder can hold its own .gitignore; this tester treats yours as the one at the root. Browsers rename a file that starts with a dot, and Chrome saves this one as gitignore.txt, so rename it after downloading. The templates are a sensible start, not a guarantee, and matching here is case-sensitive, as git is by default on Linux.
Languages
Frameworks
Infrastructure
Common
Operating systems
Editors
4 of 8 paths ignored