Git Ignore Tester
Paste a .gitignore and some paths to see whether Git ignores each one, the pattern that decides it, and why: a later pattern overriding an earlier one, or a file that can’t be brought back because its folder is ignored.
About this tool What it's for, how to use it and an example
What it's for
Find out why Git is ignoring a file you want to commit, or not ignoring one you don’t. A .gitignore is read from
top to bottom and small details change what a pattern matches: a leading or trailing /, * against **, and
whether a ! pattern can bring a file back at all.
For example, when !build/keep.txt doesn’t stop build/keep.txt being ignored, paste the file and the path here to
see that the folder rule build/ is to blame, and what to write instead.
How to use it
Paste the .gitignore and the paths to test, one a line, written from the folder the .gitignore is in. End a
folder’s path with /, as patterns ending in / only match folders. Each path is marked Ignored or
Not ignored, with the pattern that decides it and why. Mistakes in the patterns, such as a [ that’s never
closed, a backslash used as a folder separator or a non-breaking space copied from a web page, are listed above the results.
Git’s rules are followed: the last matching pattern wins; a pattern without a / (other than at the end) matches a
name at any depth; one with a / is matched from the .gitignore’s folder; * and ? stop at /, and **
crosses folders. A path inside an ignored folder is ignored whatever comes later, as Git never looks inside it.
Tick Ignore upper and lower case to match as Git does when core.ignoreCase is on; the choice is remembered.
Example
Press Try an example. build/keep.txt is ignored by build/ (line 2), and the table explains that
!build/keep.txt can’t bring it back because its folder is ignored. logs/.gitkeep is not ignored: logs/*
ignores it, but !logs/.gitkeep comes later and brings it back, which works because logs/* ignores what’s in the
folder rather than the folder itself. important.log is brought back by !important.log after *.log ignores it,
and src/build.js matches nothing.
Good to know
The patterns are tested as if they were in one .gitignore; Git also reads .gitignore files in sub-folders,
.git/info/exclude and your global excludes file, and a file Git already tracks is never ignored. To check a real
repository, run git check-ignore -v <path>. The results follow how git status treats paths; for a folder
matched only by a pattern such as foo/**, git check-ignore reports foo/ as ignored, while git status still
looks inside it.
Guide: Why is Git ignoring my file (or not ignoring it)?
| Path | Result | Deciding pattern | Why |
|---|
Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.
Saved you a few minutes? Say thanks with a coffee.
Something wrong with this tool, or missing from it? Report a bug or suggest a feature.