Test paths against ignore patterns with a matcher that implements git's real anchoring, wildcard and negation rules, naming the pattern that decided each one.
Waiting for patterns and paths
Patterns on the left, one path per line on the right. End a path with a slash to mark it as a directory.
The results appear here
Each path with whether it is ignored and which pattern decided it.
This sees only the patterns and paths you give it. Real git check-ignore also consults .git/info/exclude, your global excludes file, and any nested .gitignore in a subdirectory — and it checks the index first, because a file git is already tracking is never ignored, whatever the patterns say. That last one is the usual reason a correct pattern appears not to work.
Gitignore Tester runs entirely on your device — nothing is uploaded.
You’re on the Free plan. Compare plans
Most online ignore testers convert the pattern to a loose regular expression and match it against the whole path. That gets the three rules that actually matter wrong, which is why a tester can tell you a pattern works and git can disagree.
The first rule is anchoring. A pattern containing a slash anywhere except at its end is anchored to the directory holding the ignore file, so `doc/frotz` matches `doc/frotz` and not `a/doc/frotz`. A pattern with no slash matches at any depth. That distinction is invisible in the syntax and decides most of the cases people get wrong.
The second is that `*` does not cross a slash and `**` does. The third, and the one that produces the most confusion, is that a negation cannot rescue a file inside an already-excluded directory: git never descends into one, so no `!important.log` inside `build/` can take effect. When that happens here the result says so explicitly, names the directory responsible, and explains the fix.
What it does not claim is as important. Real `git check-ignore` also consults `.git/info/exclude`, your global excludes file and any nested .gitignore — and it checks the index first, because a file git is already tracking is never ignored whatever the patterns say. That last one is the usual reason a correct pattern appears not to work, and it is stated on the page rather than left for you to discover.
Almost certainly because a parent directory is already excluded. Git does not descend into an excluded directory, so it never sees the file to un-ignore it. The fix is to un-ignore the directory and then re-exclude its contents: `!build/` followed by `build/*` and then `!build/keep.txt`.
`logs` matches anything called logs at any depth. `/logs` is anchored to the directory holding the ignore file, so it matches only the top-level one. Any pattern with a slash that is not at the end is anchored the same way.
No. A single asterisk stops at a slash, so `src/*.ts` matches files directly in src and not in its subdirectories. `**` crosses slashes: `src/**/*.ts` matches at any depth below src.
For the patterns and paths you give it, yes. It is not the whole answer, because git also reads .git/info/exclude, your global excludes file, nested .gitignore files, and the index. A tracked file is never ignored whatever any pattern says.
End it with a slash. A trailing slash in a pattern only matches directories, and a plain list of paths carries no other signal about which is which.