Gitignore Analyzer
Validate, parse, and test path exclusions against your .gitignore configuration rules in real-time.
| Line | Pattern | Type / Status |
|---|---|---|
| Awaiting .gitignore content... | ||
Gitignore Pattern Rules Reference
1. Comments & Blank Lines
Lines starting with # are treated as comments. Blank lines are ignored entirely.
2. Negation Patterns
Prefixing a pattern with an exclamation mark (!) re-includes patterns previously ignored.
3. Directory Indicators
A trailing slash (/) specifies that the pattern matches a directory rather than a plain file.
Troubleshooting rules that do not behave as expected
A path can appear in a .gitignore file and still show up in Git for two different reasons: the pattern may not match its location, or Git may already be tracking the file. Ignore rules prevent untracked files from being added; they do not remove files from the index. If a tracked build artifact should no longer be committed, review the change with your team and use git rm --cached path/to/file to untrack it without deleting the local copy.
Check the rule Git actually matched
When the preview and repository disagree, run git check-ignore -v -- path/to/file from the repository. Git prints the source file, line number, and pattern responsible for the match. This is especially helpful when a nested .gitignore, a global ignore file, or a later rule changes the result. If the command reports nothing, check the path spelling and whether the file is already tracked with git ls-files -- path/to/file.
Use negation with its parent directory in mind
For example, *.log ignores matching log files, while !important.log attempts to keep one exception. Git cannot re-include a file when a parent directory remains excluded, so the directory may need to be made visible first. Pattern behavior also depends on slashes and on which directory contains the ignore file. This page provides a quick preview with a simplified matcher; confirm tricky patterns, nested rules, and production repository behavior with Git itself before relying on the result.