Pikkola Gitignore, tool No. 60
The files a repository should not remember.
Pick the stacks you work in and the file writes itself: caches, build output and files that only belong to your machine, with the secrets guard at the top. Then paste a path and see which line decides it, negation included. Nothing is uploaded and nothing is stored.
- 24
- stacks
- 0
- uploads
- .gitignore
- one file
The studio
Build the file, then test a path
The left half of the studio writes a .gitignore from the stacks you pick. The right half runs a path through the lines it wrote, so the file is never trusted on faith.
Pick a stack and the file writes itself
Each chip adds one section. A line that two stacks both want is written once, in the section that asked for it first, so the file stays readable.
Test a path against the lines
One path per line, written as it appears in git. A line that ends with a slash is a folder. The answer names the line that decided it, or says that no line did.
Edit these lines to test a file you already have. The next change to the file above replaces them unless you press Use the built file first.
What the lines mean
A .gitignore is short and read top to bottom. These are the rules the tester applies, and the ones a hand written file usually gets wrong.
- 1The last matching line winsOrder is the whole language. *.log ignores a file, a later !keep.log brings it back, and a later keep.log takes it away again.
- 2A slash in the middle anchors the linebuild/ matches a build folder at any depth, while /build/ matches only the one at the root. Writing dist/app.js pins the line to that exact path from the root.
- 3A slash at the end means a folderlogs/ ignores the folder and everything inside it, and leaves a file named logs alone. Without the slash the line matches both.
- 4A star stops at a slash, two stars cross*.js matches app.js and src/app.js but not lib/app.js.map, because the star cannot cross a slash. lib/**/*.map reaches the same file through the folders.
- 5A ! line cannot rescue a file under an ignored folderWith logs/ and then !logs/keep.log, the file stays ignored. Git never opens an ignored folder, so the second line has nothing to act on.
- 6A line with no slash matches at any depth*.pyc covers a file in every folder of the repository. .pytest_cache/ does the same for every folder with that name.
Questions
Is the .gitignore or the path sent anywhere?
No. There is no endpoint to send it to. The builder, the matcher and the page are files on this domain, and the Content-Security-Policy sets connect-src to none. Load the page once and it keeps working with the network off.
Which stacks can I combine?
Twenty four: Node.js, Next.js, Python, Django, FastAPI, Go, Rust, Java, Spring Boot, Kotlin, Swift and Xcode, Flutter, Cloudflare Workers, Terraform, Ruby, PHP, C and C++, macOS, Windows, Linux, VS Code, JetBrains, Vim and Sublime Text. Any mix is allowed, and a line that repeats is written once.
Is the file complete for my project?
It is a clean starting point, not a promise. A project with its own generated files, a monorepo with nested rules, or a tool not in the list still needs a line or two of its own. Test the paths you care about on the right and add what is missing.
Why is my path ignored when no line names it?
Because a folder above it is ignored. With node_modules/ in the file, node_modules/express/index.js is ignored even though no line mentions express. The verdict says which folder did it.
Why does my ! line not bring a file back?
Git does not look inside an ignored folder, so a file beneath one can never be re-included. Write the excluding line for the files you want to keep, or un-ignore the folder first and then the file.
What about .gitignore files in subfolders?
This page reads one file, as if it sat at the root of the repository. A nested .gitignore applies to its own folder and below, and its lines are read after the root file, so a nested file can re-include what the root excluded. Keep a copy of each in mind when a path still surprises you.