.gitignore Tester

A tool that takes a root .gitignore and a list of relative file and directory paths, and shows whether Git ignores each path along with the rule and line number that applied. You can verify wildcards, directory patterns, negation, rule order, and what happens when a parent directory is excluded — all processed in your browser.

Nothing you enter is sent to a server. All checks run in your browser.
  • Checks one .gitignore at the repository root against paths relative to the root. Nested .gitignore files, .git/info/exclude, and global settings (core.excludesFile) are not covered.
  • Paths are treated as untracked files. .gitignore doesn't apply to files that are already committed (tracked); use git rm --cached to stop tracking them.
  • End directory paths with / (e.g. dist/). Matching is case-sensitive. Character class names such as [[:alpha:]] are not supported.

Result

Enter paths to see whether each one is ignored and why.

How to use

  1. Paste the .gitignore contents on the left or load the file.
  2. Enter paths to check on the right, one per line. End directories with / (e.g. dist/).
  3. Each path shows Ignored or Not ignored, with the line number of the rule that applied.
  4. When a negation rule has no effect because a parent directory is excluded, the reason is shown.

About this tool

Patterns like "exclude build output but keep one config file" often fail because of how negation (!) and rule order work. This tool shows which rule last matched each path, with its line number.

Git doesn't look inside excluded directories, so after excluding dist/, a negation like !dist/keep.json has no effect. In that case the parent directory is shown as the cause. Excluding the contents instead, as in dist/**, lets a negation re-include a specific file.

Paths are treated as untracked files; .gitignore doesn't apply to files already tracked. Nested .gitignore files and global settings are not covered in this version.

Use *.log as the first rule and !keep.log as the second, then test debug.log and keep.log. debug.log is ignored, while keep.log is included again by the later exception. The reported rule line identifies which entry determined each result.

Enter paths relative to the repository and add a trailing / for directories. The tool does not inspect Git tracking state, so use its results to test rules for untracked paths. Pattern parsing and matching run in the browser.

Frequently asked questions

Why is a file still ignored after negating it with !?

If a parent directory is excluded, Git never looks inside, so the negation has no effect. Exclude the contents (dir/**) instead of the directory, then negate.

Does it apply to files already committed?

.gitignore doesn't apply to tracked files. This tool treats paths as untracked. Use git rm --cached to stop tracking a file.

What does a trailing / mean?

In a rule, it matches directories only. In the path list, entries ending with / are treated as directories.