.gitignore Generator

Build your .gitignore from 312 official templates, including Bun, Tauri, Expo, NestJS and Cursor. It explains what each rule ignores and tests whether a path is excluded.

Your .gitignore

Pick at least one template to generate your .gitignore.

Templates from github/gitignore (public domain, CC0). Everything is generated in your browser.

Compartir

What this tool does

You pick the languages, frameworks, editors and operating systems your project uses, and it hands back a ready-to-copy .gitignore built from the 312 official templates in github/gitignore. That much any generator does. What is added here are the two things that were missing:

  • It explains what each rule ignores. Not an opaque block of text you copy on faith, but what __pycache__ actually is, why .env is the most important line in the file, and what the trailing slash on build/ implies.
  • It tests a specific path. Type src/index.ts or node_modules/react/index.js and it tells you whether it would be ignored and, more importantly, which rule decided it.

The catalogue is current

This matters more than it sounds. The sector’s veteran generators carry templates that have not been synced in years, so if your stack is recent you simply will not find it. These are all here:

Bun, Tauri, Expo, NestJS, Nix, OpenTofu, LangChain, Gleam, AWS CDK, plus the current generation of editors and tooling: Cursor, Zed, mise, Lefthook and agent files.

The catalogue is vendored whole from the official repository, which is CC0 — public domain — and refreshed by running a script. No calls to any external service.

How to use it

  1. Search for your language, framework, editor or operating system. You can pick several.
  2. Copy or download the generated .gitignore.
  3. Scroll to What each rule means to understand what you just copied.
  4. Use Test a path whenever you are unsure about a specific file.

One tip: always add your editor and operating system templates, not just the language one. Half the noise in a shared repository is macOS .DS_Store files and PhpStorm .idea folders nobody meant to commit.

Five things worth understanding about the format

The last matching rule wins

Not the first. If you have *.log and further down !important.log, that specific file is tracked, because the negation appears later. Flip the order and it stops working. This is the source of nearly every “I don’t understand why this is ignored”.

A trailing slash restricts to directories

build/ ignores the build folder but not a file named build. Without the slash, build affects both. When in doubt, add the slash: it is more precise and avoids surprises.

A leading slash anchors to the root

/dist ignores only the dist at the repository root. A bare dist ignores any folder with that name, at any depth. In a monorepo the difference is enormous.

* stops at the slash, ** does not

docs/*.md affects the .md files directly inside docs. docs/**/*.md also covers its subfolders.

.gitignore does not remove what is already tracked

This is the one that wastes the most time. A .gitignore only affects files Git is not tracking yet. If you already committed something, adding it to the file does nothing — you have to remove it from the index.

git rm --cached path/to/file
git commit -m "stop tracking the file"

For a whole folder, git rm -r --cached path/.

If a .env slipped through

It deserves its own section because it is the most expensive accident and the most misunderstood.

Removing the file from the index does not delete it from history. Anyone with repository access can recover the contents from an earlier commit, and if the repository is public you should assume a crawler has already indexed it. The only real remedy is:

  1. Rotate the secrets. Change the passwords, revoke the API keys, regenerate the tokens. This first, before anything else.
  2. Remove the file from the index and add it to .gitignore.
  3. If history genuinely needs cleaning, git filter-repo rewrites the commits — but it forces everyone on the team to re-clone.

Order matters: rewriting history without rotating the keys is doing the hard work and leaving the danger untouched.

What this tool does not do

  • It does not read your project. You choose the templates; there is no auto-detection because that would mean uploading your files somewhere.
  • It does not explain every rule. The dictionary covers the most frequent ones in the corpus. Rules we do not know are shown unannotated rather than given an invented explanation.
  • It does not modify your repository. It generates text that you copy yourself.

About the source

Templates come from github/gitignore, the official collection GitHub maintains, published under CC0 1.0 — a waiver of copyright, so it can be used and redistributed with no obligations. It is credited anyway, because that is the honest thing to do.

Frequently asked questions

Where do the templates come from?

From the github/gitignore repository, the official collection GitHub maintains, published under CC0 — public domain. There are 312 templates across languages and frameworks, editors and operating systems, and community contributions. They are vendored whole into the tool, so it works without calling any external service.

Does it include recent stacks like Bun or Tauri?

Yes, and that is the main difference from the sector's veteran tools. The catalogue includes Bun, Tauri, Expo, NestJS, Nix, OpenTofu, LangChain, Gleam and current-generation editors such as Cursor, Zed and agent files. Many popular generators have not synced their templates since 2023, and those are simply missing.

What does a trailing slash on a rule mean?

It limits the rule to directories. Writing build/ ignores the build folder but not a file named build with no extension. Without the slash, the rule affects both. The tool annotates this and the rest of the syntax details on every rule it generates, which is exactly what a bare block of text does not tell you.

I already committed a file — does adding it to .gitignore delete it?

No. A .gitignore only affects files Git is not tracking yet. If you already committed it, you have to remove it from the index with git rm --cached path/to/file and commit that change. And if what slipped in was a .env with credentials, it is still in history: you need to rotate those secrets, because deleting them from the file does not remove them from earlier commits.

What is the path tester for?

To answer the question you actually have: whether one specific file will end up ignored. You type the path and it tells you the result and, more importantly, which rule decided it. That helps when you combine several templates and a negation rule with ! is quietly re-including something, because in gitignore the last matching rule always wins.

Reviews & ratings

No reviews yet. Be the first to leave one!

Write a review

Your rating *