.gitignore Pattern Tester
Tests which paths a .gitignore ignores and which line decides each result. It supports comments, negation, directory-only patterns, anchors, *, ?, character ranges, ** wildcards and last-match-wins.
Use the tool
Why this tool exists
.gitignore rules look simple until one does not do what you expect. A file stays tracked, a negation is ignored, or a pattern matches more than you meant. The usual way to find out is to commit and run git status, or git check-ignore on a real checkout. This tool lets you paste the file and a list of paths and see, for each one, whether it is ignored and which line decided it. It follows Git's rules: later lines win, a trailing slash means a directory, a leading slash anchors the pattern, ** crosses directories, and a file inside an ignored directory cannot be re-included. It checks a single .gitignore, without nested files or global excludes. It runs in your browser.
How to use it
- Paste the contents of your .gitignore into the first box.
- Paste the paths to test into the second box, one per line, relative to the repository root. End directories with a slash.
- Read which paths are ignored and which rule decided each result.
Frequently asked questions
Which rules does it support?
Comments, blank lines, negation with !, directory-only patterns with a trailing slash, anchored patterns, *, ?, character ranges and ** wildcards, with the last matching line winning.
Why can't I re-include a file in an ignored directory?
Git does not look inside a directory that is ignored, so a negation for a file within it has no effect. Re-include the directory itself first.
What does it not cover?
Nested .gitignore files, the global excludes file, .git/info/exclude and files that are already tracked, which Git keeps tracking even if they match a rule.
How do I mark a path as a directory?
End the path with a slash, for example build/. Paths without a trailing slash are treated as files, which matters because directory-only patterns match only paths marked as directories.