.gitignore Generator
AI-poweredPick from 21 stack templates or describe your project in plain English. Get a labelled, deduplicated .gitignore to copy or download.
.gitignore · 6 sections · 36 lines
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
lerna-debug.log*
.npm
.yarn-integrity
# Next.js
.next/
out/
next-env.d.ts
.turbo/
# Env files
.env
.env.local
.env.*.local
# Vercel
.vercel/
# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
.Spotlight-V100
.Trashes
# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
Save it as .gitignore in the root of your repository. Some browsers drop the leading dot when downloading, so rename the file if it saves as gitignore.
01 · Definition
What is a .gitignore file?
A .gitignore file lists patterns for files Git should leave untracked, such as dependencies, build output, logs and local secrets. Each line is one pattern. Git reads the file in the repository root and in any subdirectory, and a pattern has no effect on files Git is already tracking.
02 · Overview
How the .gitignore Generator works
Build a .gitignore for a mix of languages, frameworks, editors and operating systems. There are two modes: pick from 21 built-in templates, which are merged in your browser, or describe the project and let an AI model write the file. Each stack gets a comment header, duplicate entries are removed, lockfiles are never ignored, and the result can be copied or downloaded. Chrome drops the leading dot from downloaded file names, so rename the file to .gitignore if it saves as gitignore.
03 · Guide
.gitignore pattern syntax
Each line is one pattern, matched against paths relative to the directory the .gitignore file is in. The rules in the table are taken from the gitignore page of the Git documentation.
Two rules cause most surprises. A pattern with no slash, or with only a trailing slash, matches at every level below the file, while a slash at the start or in the middle ties it to the .gitignore file's own directory. And a file cannot be re-included with ! if its parent directory is ignored, which is why the VSCode template here ignores .vscode/* rather than .vscode/ before keeping settings.json and extensions.json.
| Pattern | Matches |
|---|---|
| # text | Nothing: a line starting with # is a comment |
| *.log | Any file or directory ending in .log, at any depth |
| build/ | Directories named build at any depth, not a file named build |
| /build | build only in the same directory as the .gitignore file |
| docs/*.md | Markdown files directly inside docs, not in its subdirectories |
| **/logs | logs in any directory, the same as writing logs |
| logs/** | Everything inside logs, to any depth |
| a/**/b | a/b, a/x/b, a/x/y/b and so on |
| file?.txt | ? is any one character except /: file1.txt, not file10.txt |
| *.py[cod] | [ ] is one character from a set: .pyc, .pyo and .pyd |
| !keep.log | Re-includes a file that an earlier pattern ignored |
| \#notes | A file named #notes: a backslash escapes #, ! and trailing spaces |
04 · Guide
Which stacks have a .gitignore template?
Pick stacks merges any of 21 built-in templates in your browser, in the order you pick them, with a comment header per stack. Six are selected when the page loads: Node.js, Next.js, Env files, Vercel, macOS and VSCode. For anything not listed, describe the project and the AI mode writes the file.
| Group | Templates |
|---|---|
| Languages | Node.js, Python, Rust, Go, Java, Ruby |
| Frameworks | Next.js, Vite, Remix, SvelteKit, Astro |
| Build and env | Env files, Vercel, Logs |
| Infrastructure | Docker, Terraform |
| Editors | VSCode, JetBrains |
| Operating systems | macOS, Windows, Linux |
05 · Use cases
When to use the .gitignore Generator
- 01
Bootstrap a fresh repo with a sensible .gitignore
- 02
Add a new language to an existing repo without searching for the right template
- 03
Get a .gitignore for a polyglot project where no single template fits
- 04
Compare your current .gitignore with a generated one for the same stack
06 · Examples
.gitignore Generator examples
Pick stacks: Node.js, macOS, JetBrains, VSCode
ex 01# Node.js node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* .pnpm-debug.log* lerna-debug.log* .npm .yarn-integrity # macOS .DS_Store .AppleDouble .LSOverride ._* .Spotlight-V100 .Trashes # JetBrains .idea/ *.iml *.iws *.ipr # VSCode .vscode/* !.vscode/settings.json !.vscode/extensions.json
The exact output of the built-in templates for a Node project on a Mac. Shared VS Code settings stay tracked.
Pick stacks: Python, Env files
ex 02# Python __pycache__/ *.py[cod] *$py.class *.so .Python .venv/ venv/ env/ *.egg-info/ .pytest_cache/ .mypy_cache/ .ruff_cache/ .coverage # Env files .env .env.local .env.*.local
Bytecode, virtual environments and tool caches, plus the env files that hold secrets.
Describe: Next.js app with Python data scripts and a Rust CLI
ex 03# Next.js .next/ out/ # Python __pycache__/ *.py[cod] .venv/ # Rust target/ # macOS .DS_Store
Illustrative AI output; the exact entries vary. Cargo.lock is left tracked, as it should be for a binary.
Describe: Go service with Docker and Terraform
ex 04# Go bin/ *.exe *.test # Terraform .terraform/ *.tfstate *.tfstate.* # Env files .env
Illustrative AI output. Terraform state is ignored because it can contain secrets; .terraform.lock.hcl is kept.
07 · FAQ
.gitignore: frequently asked questions
Where does the template data come from?
Is the order of entries significant?
Should I commit .env files?
Why is package-lock.json or pnpm-lock.yaml not ignored?
Does it handle nested .gitignore files?
How do I ignore a file that's already tracked?
What happens to the description I type?
08 · Reference
Specs and further reading
These are the primary sources this tool follows. Where a specification defines the behaviour, we link the specification, not a summary of it.
- gitignore documentation
Git. The pattern format reference, covering negation, directory matching, and precedence.
- github/gitignore
GitHub. The community-maintained collection of full per-language templates, for when the short built-in ones are not enough.
09 · More
Tools that pair with .gitignore
Open Source License Generator
Pick MIT, Apache 2.0, GPL v3, BSD, ISC, MPL 2.0, Unlicense or CC0. Get the full LICENSE file to copy or download.
Meta Tags GeneratorAI-powered
Generate the SEO, Open Graph and Twitter Card meta tags for a page, with a link preview. An AI model can suggest the title and description from a brief.
Cron Expression GeneratorAI-powered
Turn plain English into a cron expression, or paste one to get a plain-English reading, a field-by-field breakdown and its next 5 run times.
Robots.txt Generator
Build a robots.txt file with Allow and Disallow rules per crawler, sitemap lines and presets for blocking AI training bots. Copy or download it.