Skip to content

.gitignore Generator

Build a .gitignore from GitHub’s official templates, then test whether any path would be ignored.

Choose templates

Loading templates…

Your own rules

.gitignore

### Custom ###
.env
.env.local
2 rules

Would git ignore this?

A path from the repository root. End it with / for a folder.

Not ignored — git will track it — no rule matches.

How is this calculated?
last matching rule wins · !pattern un-ignores · pattern/ matches folders only pattern with a / is relative to the root · * and ? stay inside one folder · ** crosses folders a file inside an ignored folder can’t be un-ignored

Runs in your browser — nothing you enter leaves this device.

About this tool

What it does

A .gitignore file tells Git which files never to commit — dependencies such as node_modules, build output, editor settings, operating-system clutter like .DS_Store, and secrets in .env files. This generator combines GitHub’s own maintained templates for 29 languages, frameworks, operating systems and editors into one file, under clear section headers, and adds your own rules at the end. It can remove rules repeated across templates, but only where removing them can’t change what’s ignored. Its tester answers the question people actually search for — “why is Git ignoring this file?” — by showing whether a path would be ignored and which line decided it.

How to use it
  1. Pick the templates for your project: a language, any framework, your operating system and your editor. Search narrows the list.
  2. Add your own rules, such as .env or a local data folder.
  3. Leave “Remove repeated rules” on for a shorter file, or turn it off to keep each template complete.
  4. Type a path into the tester to see whether Git would ignore it and why. End a folder with /.
  5. Copy the result into a file named .gitignore at the root of your repository.
Limits and your data
  • .gitignore only affects untracked files. If a file was committed before you ignored it, remove it from the index with git rm --cached <file>.
  • The tester follows the .gitignore rules in Git’s documentation and was checked against git check-ignore, but it only reads this one file — not .gitignore files in subfolders, .git/info/exclude or your global excludes file.
  • Templates come from GitHub’s github/gitignore collection at the date shown and can lag behind very new tools.
  • Never rely on .gitignore to protect secrets that were already committed; rotate them.
  • The templates are built into the page and everything is combined and tested in your browser. Your selections, rules and paths are never sent anywhere.

Questions

Why is Git still showing a file I added to .gitignore?

Because it’s already tracked. .gitignore stops new files being added; it doesn’t remove committed ones. Run git rm --cached <file> (or -r for a folder), commit, and it will stay ignored from then on.

Why doesn’t my !rule bring a file back?

If a folder is ignored, Git never looks inside it, so a ! rule for a file in that folder has no effect. Ignore the folder’s contents instead — folder/* then !folder/keep.txt — and the tester will show the difference.

What is the difference between build and /build?

build matches a file or folder called build anywhere in the repository. /build matches only the one at the root, and build/ matches only folders.

Can I commit an empty folder?

Git doesn’t track empty folders. The usual trick is a file inside it, such as .gitkeep, together with rules like folder/* and !folder/.gitkeep.