Free Glob and Gitignore Tester
Paste patterns and a list of paths to see exactly which line matched, ignored or re-included each file.
What is a Glob and Gitignore Tester?
Glob patterns such as src/**/*.ts pick files by name, and a .gitignore uses a similar syntax to tell git which files to leave alone. This tester checks a list of paths against either kind and shows which pattern line decided each one.
Glob mode uses picomatch, the matcher inside micromatch, fast-glob and chokidar, with its default options. Gitignore mode uses the ignore package, which follows the gitignore documentation: the last matching line wins, a negated line re-includes, a leading slash anchors to the root, and a file can’t be re-included once its parent folder is excluded.
Key Features
The Deciding Line, Not Just Yes or No
Every path shows the line number and pattern that matched, excluded, ignored or re-included it. When a rule misbehaves, you see which line to change.
Two Rule Sets, Side by Side
Switch between glob and .gitignore on the same patterns to see how differently they treat negated lines, dotfiles and folders.
Git’s Parent-Folder Rule Applied
A negated line can’t rescue a file inside an excluded folder, and the tester reports that exactly the way git does. That one rule causes most unexplained gitignore results.
Directories Tested Correctly
Write a path with a trailing slash, like build/, and it’s tested as a directory, so directory-only patterns match it and not a file with the same name.
Paths Stay on Your Machine
Matching runs in the browser, so internal repository layouts and file names aren’t uploaded anywhere.
Perfect for everyone
- Developers fixing a .gitignore
- DevOps engineers writing CI path filters and .dockerignore files
- Maintainers publishing packages
- Anyone learning glob syntax
How to Use the Glob and Gitignore Tester
Choose the rule set, paste patterns and paths, and read which line decided each path.
Pick Glob or .gitignore
Glob suits build tools, linters, CI path filters and package files. Choose .gitignore for git, and for .npmignore files, which use the same rules.
Paste Your Patterns
Put one pattern per line in the first box. Lines starting with # are comments, and blank lines are skipped, so you can paste a real .gitignore as it is.
List the Paths to Test
Add one path per line, relative to the repository root, such as src/app.ts. End a path with a slash, like dist/, to test it as a directory.
Read the Deciding Line
The report lists every path with the line and pattern that decided it, and the table adds a Result column. Edit a pattern and every result updates at once, so you can try fixes quickly.
Patterns Against Real Paths
In each example the patterns come first, then a line of three dashes, then the paths. The answer is the report the tester produced in the mode on the chip, so predict each path before you reveal it.
“src/**/*.ts !**/*.test.ts --- src/app.ts src/lib/format.ts src/app.test.ts README.md”
“*.{js,ts} --- index.js index.ts index.css”
“**/* --- .env src/.cache/data src/app.ts”
“docs/* --- docs/guide.md docs/api/intro.md”
“node_modules/ *.log !important.log --- node_modules/react/index.js error.log important.log src/app.ts”
“logs/ !logs/keep.log --- logs/keep.log”
“/dist --- dist/app.js packages/web/dist/app.js”
“build/ --- build/ build”
“*.log --- /var/log/app.log”
“# patterns go here --- src/app.ts”
Glob and Gitignore Syntax
The two rule sets share most of their wildcards and differ on a few that matter. These ten cover nearly every real pattern.
A Single Star Stays in One Folder
A star matches any run of characters except a slash. docs/* matches docs/guide.md but not docs/api/intro.md.
“Does docs/* match docs/api/intro.md?”
A Double Star Crosses Folders
Standing alone between slashes, ** matches any number of folders, including none. src/**/*.ts finds TypeScript files at any depth under src.
“Does src/**/*.ts match src/app.ts?”
A Question Mark Is One Character
A question mark stands for exactly one character other than a slash. file?.txt matches file1.txt but not file10.txt.
“Does file?.txt match file10.txt?”
Brackets Match a Set
[abc] matches one listed character and [0-9] a range. An exclamation mark or caret just inside the opening bracket inverts the set.
“Does log[0-9].txt match log7.txt?”
Braces List Alternatives in Globs
*.{js,ts} matches files ending in either extension, a feature of picomatch and Bash. .gitignore has no braces, so write one line per extension there.
“Does .gitignore expand braces?”
A Leading Exclamation Mark Means Two Things
In a glob list, a pattern starting with an exclamation mark excludes paths another pattern matched. In .gitignore, the same prefix re-includes a path an earlier line ignored.
“What does !important.log do in .gitignore?”
Globs Skip Dotfiles by Default
picomatch and most glob libraries ignore names starting with a dot unless the pattern names the dot, so **/* misses .env. In .gitignore, a star does match .env.
“Does **/* match .env in picomatch by default?”
A Slash Anchors a .gitignore Line
A pattern with a slash at the start or in the middle matches from the folder holding the .gitignore. Without one it matches at any depth.
“Does /dist ignore packages/web/dist?”
A Trailing Slash Means Directories Only
build/ matches a directory called build and everything inside it, but not a file called build. Test directories here by writing them with a trailing slash.
“Does build/ match a file named build?”
The Last Matching Line Wins
git reads a .gitignore top to bottom, and the final line that matches decides. Put broad rules first and the exceptions after them.
“Which line decides when two lines match?”
Where These Patterns Are Used
The same few wildcards appear in a dozen config files, each with small differences.
.gitignore and .npmignore
git reads .gitignore files in every folder, plus .git/info/exclude and your global excludes file. npm applies the same rules to .npmignore when it packs a release.
.dockerignore
Docker uses Go’s pattern matching with double stars and negation added, which is close to gitignore but not identical. Check unusual patterns against Docker’s documentation.
Build Tools and Linters
ESLint, Prettier, TypeScript’s include and Vite take glob lists through picomatch, micromatch or minimatch. Their dot and case options may differ from the defaults here.
CI Path Filters
GitHub Actions paths and paths-ignore filters use globs with ** and !, so a workflow runs only when matching files change.
CODEOWNERS
CODEOWNERS uses gitignore-style patterns without negation, and the last matching line wins. Test ownership with the CODEOWNERS Tester.
Shell Globs
Bash expands star and question mark itself, and ** only with shopt -s globstar. Quote a pattern you pass to a tool, or the shell expands it first.
Pattern Mistakes That Waste an Afternoon
Most surprising results trace back to one of these.
A Single Star Stops at Slashes
docs/*.md misses docs/api/intro.md. Use docs/**/*.md to include every subfolder.
Forgetting Dotfiles
A glob like **/* skips .env and .github in most libraries. Add a separate .* pattern, or turn on your library’s dot option.
Re-including Inside an Ignored Folder
!logs/keep.log does nothing after logs/, because git never looks inside an excluded directory. Ignore logs/* instead, then re-include the file.
Unanchored Patterns Match Everywhere
A dist line in .gitignore also ignores src/dist and packages/web/dist. Add a leading slash when you mean only the top-level folder.
Tracked Files Stay Tracked
A new .gitignore line doesn’t untrack files git already tracks. Run git rm --cached on them once, and the rule applies from then on.
Backslashes Aren’t Folder Separators
Patterns always use forward slashes, even on Windows. The tester converts backslashes in paths, but in a pattern a backslash escapes the next character.
Case Sensitivity Differs
.gitignore mode compares names case-insensitively, like git on macOS and Windows, while glob mode is case-sensitive like picomatch. On Linux, git is case-sensitive too.
Test the Paths Your Tool Really Sees
Some tools pass absolute paths or paths relative to a subfolder. Paste paths in the form the tool receives, relative to the root it uses.
When to Test a Pattern
Before you commit a rule, and whenever a file is unexpectedly included or left out.
Fixing a .gitignore That Doesn’t Work
Paste the file and the paths git still shows, and see which line ignores or re-includes each one.
Checking What a Build Includes
Test a tsconfig include list or a bundler glob against your files before wondering why one isn’t compiled.
Writing CI Path Filters
Confirm that a workflow’s paths filter fires for source changes and skips documentation-only commits.
Trimming a Docker Build Context
Check that node_modules, .git and build output stay out of the context, which keeps image builds fast.
Reviewing a .gitignore Change
When a pull request edits .gitignore, test the new rules against the repository’s files to catch accidental ignores.
Learning Glob Syntax
Try stars, double stars and brackets on a handful of paths and see right away which line matched.
Publishing a Package
Test package files lists and .npmignore rules so secrets and test fixtures stay out of the published tarball.