About
Tool No. 60 of Pikkola
A .gitignore records decisions about what belongs to a repository and what belongs to one machine. Most of it is written once and never read again, which is how a wrong line survives for years. This page writes one, and then tests paths against it instead of trusting it.
What it does
- Builds a .gitignore from twenty four stacks: languages, frameworks and platforms, operating systems and editors.
- Writes every pattern once, in the first section that asked for it, and skips a heading that has nothing left to say.
- Puts the secrets guard at the top: .env and its variants, key and certificate files, credentials.json, node_modules/ and .DS_Store, with .env.example kept out of the rules.
- Copies the file or downloads it as .gitignore.
- Tests a path against the lines and names the one that decided, or the folder above that did it instead.
- Speaks English, Korean and Japanese, follows the light and dark theme, and copies every result.
How the file is assembled
The guard comes first, then languages, then platforms, operating systems and editors, each in the order of the catalogue. The order you press the chips in does not matter, so the same selection always produces the same bytes and two people can read the same file. A line a later section also wants is skipped there; if a section loses every line that way, its heading goes too.
Blank lines separate sections and the file ends with a newline. Nothing else is added: no date, no generated-by comment, no editor setting. What you download is exactly what you reviewed above it.
How a path is decided
Each line becomes a pattern, the patterns are tried against the path in order, and the last one that matches decides. If none matches, the file stays tracked. Before the path itself, every folder above it is tested: if one is excluded, the path is excluded as well, and the panel names that folder, because git never enters an excluded folder.
- A line with no slash matches a name at any depth, so
*.pyccovers every folder. - A line with a slash is read from the root of the repository, so
dist/app.jsmeans that path and nothing else. - A slash at the end makes it a folder rule:
logs/ignores the folder and its contents and leaves a file named logs alone. *and?stop at a slash.**crosses folders, in the three documented positions: at the start, at the end and between two slashes.- A
!line brings back what an earlier line excluded, unless a folder above it is excluded. - A
#line is a comment, a backslash escapes a leading # or ! and a space at the end, and trailing spaces are dropped.
All of this is applied to one file, read as if it sat at the root of the repository.
Where the limits are
- One file only. A nested .gitignore, .git/info/exclude and the global core.excludesFile are not read, and they can change the answer for a path inside their reach.
- Case. The matcher compares case-sensitively, while git on a case-insensitive filesystem, which is the default on macOS and on Windows, matches a name whatever its case. A path shown as kept here can still be ignored there.
- A folder is known from the trailing slash you type. The page cannot look at your disk, so
tests/andtestsare two different questions. - Two stars in any other position are read as one star, which is what git does:
a**bisa*b. - The catalogue is a starting point. A tool that is not in the list, a generated file that is specific to one project, and a rule the team invented are written by hand.
- Names are compared by code point. A filesystem that normalises Unicode can hold the same visible name in two forms, and only one of them will match a line written the other way.
Why it is free
Pikkola builds small tools with one job each and keeps them free, with no account and no lock on the result. A page that runs in the browser costs almost nothing to serve, so there is no reason to charge for it or to watch who uses it.
Contact
A stack that belongs in the list, a path this page decides differently from git, a Korean or Japanese sentence that reads badly: hello@pikkola.com. The rule lines and the path are the most useful thing to send.