Browser-based Validate tool

.gitignore Tester

Enter patterns and candidate paths to see which files would be ignored by common glob rules.

100% browser-based · No upload to server · Free to use
Browser processing · up to 5 MB per file
0 chars
0 chars

.gitignore Pattern Tester

Test whether a specific file path is ignored or tracked by Git using the syntax rules from your .gitignore file. This tool evaluates your glob patterns against candidate paths locally in your browser, helping you debug why certain files are unexpectedly appearing in git status or failing to be ignored.

Inputs and Outputs

  • Input: Your .gitignore rules (pasted text or loaded from a local file) and a list of file paths you want to check.
  • ** A clear verdict for each path: Ignored or Tracked**.

How It Works

The tool applies standard Git glob matching logic (similar to fnmatch) to your patterns. It does not connect to your repository; it simply simulates the rule engine based on the text you provide. If a rule matches a parent directory, the tool reflects that the contents inside will not be re-evaluated for negation, which is a common source of confusion.

Why Your Patterns May Not Behave as Expected

Negation Rules and Directory Exclusion

You cannot un-ignore a file if its parent directory is already excluded. For example, if you have logs/ in your .gitignore, adding !logs/error.log will not work because Git never looks inside logs/ to find the negation pattern. You must remove the parent directory exclusion or use a more specific file pattern to allow exceptions.

Pattern Scope

  • Root patterns: Patterns without a leading slash (e.g., *.log) match files at any depth.
  • Rooted patterns: Patterns with a leading slash (e.g., /tmp) match only from the root of the repository.
  • Trailing slashes: A trailing slash (e.g., dist/) matches directories only, not files.

Order Matters

The last matching rule wins. If you ignore *.js but then add !src/main.js, the file will be tracked. However, if you ignore src/ later, the exception is voided. Use this tool to verify the final state of your rule stack.

Practical Use Cases

  • Debugging git status: You added a .env file, but it’s still showing up. Test your !.env exception against the *.env ignore rule to see if the negation is actually applying.
  • Pre-commit Cleanup: Before committing a new dependency folder, test whether node_modules/ is correctly excluding all subdirectories.
  • Documentation: Provide a clear list of what is ignored for onboarding new developers, generated directly from your tested rules.

Limitations and Privacy

Not a Repository Scanner

This tool does not read your actual .git directory or check which files are currently tracked by Git. A file that is already tracked in your repository will remain tracked even if you add an ignore pattern for it. You must use git rm --cached to untrack existing files; the .gitignore file only affects new or untracked files.

Browser-Local Processing

Your patterns and file paths are processed entirely within your browser. No data is sent to a server. This means you can safely test sensitive path names without uploading your code, but you must ensure your browser supports the necessary JavaScript features for glob matching.

Important: browser parsers cover common practical cases. Always review generated files before using them in production, especially for configuration, subtitles, images and security-sensitive data.

Frequently asked questions

Will this tool show if a file is already tracked in my repo?

No. This tool only evaluates the ignore rules against path names. It does not access your repository history or index. If a file is already committed, changing your .gitignore will not untrack it. Use git rm --cached <file> to remove it from tracking first.

Why does !important.log not un-ignore my file?

This usually happens if a parent directory of important.log is itself ignored (e.g., logs/ is in .gitignore). Git does not descend into ignored directories to apply negation patterns. You must remove the parent directory rule or use a pattern that specifically targets the file without ignoring its container.

Can I test patterns for submodules or nested repositories?

Yes, you can test glob patterns for any path string. However, note that .gitignore rules in the root repository do not apply inside a submodule’s working tree. Each submodule has its own .gitignore that is evaluated independently.

Does this tool support Git’s :: glob syntax for negation?

Standard Git .gitignore uses ! for negation. The :: syntax is not a standard Git feature; it is used in some IDE configurations or other version control systems. This tool implements standard Git glob matching, so use ! for negation patterns.

What happens if I have conflicting patterns like *.log and !debug.log?

The last matching rule wins. If *.log appears before !debug.log, then debug.log will be tracked (ignored rule overridden). If !debug.log appears before *.log, then debug.log will be ignored (because the final matching rule is the ignore). Order is critical in .gitignore files.