— Developer Tools

Free Glob and Gitignore Tester

Paste patterns and a list of paths to see exactly which line matched, ignored or re-included each file.

— Samples
Paths 8Matched 2Valid
Live

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.

1

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.

2

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.

3

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.

4

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.

Worked Examples

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.

REF_001Glob with an exclusion

“src/**/*.ts !**/*.test.ts --- src/app.ts src/lib/format.ts src/app.test.ts README.md”

REF_002Glob braces

“*.{js,ts} --- index.js index.ts index.css”

REF_003Glob and dotfiles

“**/* --- .env src/.cache/data src/app.ts”

REF_004Single star and folders

“docs/* --- docs/guide.md docs/api/intro.md”

REF_005.gitignore with a re-include

“node_modules/ *.log !important.log --- node_modules/react/index.js error.log important.log src/app.ts”

REF_006Re-include inside an ignored folder

“logs/ !logs/keep.log --- logs/keep.log”

REF_007Anchored pattern

“/dist --- dist/app.js packages/web/dist/app.js”

REF_008Directory-only pattern

“build/ --- build/ build”

REF_009Absolute path

“*.log --- /var/log/app.log”

REF_010Only a comment

“# patterns go here --- src/app.ts”

Syntax

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.

01 / A

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?”

02 / A

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?”

03 / A

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?”

04 / BRACKETS

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?”

05 / BRACES

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?”

06 / A

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?”

07 / GLOBS

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?”

08 / A

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?”

09 / A

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?”

10 / THE

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.

Tip 01

A Single Star Stops at Slashes

docs/*.md misses docs/api/intro.md. Use docs/**/*.md to include every subfolder.

Tip 02

Forgetting Dotfiles

A glob like **/* skips .env and .github in most libraries. Add a separate .* pattern, or turn on your library’s dot option.

Tip 03

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.

Tip 04

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.

Tip 05

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.

Tip 06

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.

Tip 07

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.

Tip 08

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.

Frequently Asked Questions