Skip to content

.gitignore Generator

AI-powered

Pick from 21 stack templates or describe your project in plain English. Get a labelled, deduplicated .gitignore to copy or download.

How to build the file
Languages
Frameworks
Build & env

.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.

PatternMatches
# textNothing: a line starting with # is a comment
*.logAny file or directory ending in .log, at any depth
build/Directories named build at any depth, not a file named build
/buildbuild only in the same directory as the .gitignore file
docs/*.mdMarkdown files directly inside docs, not in its subdirectories
**/logslogs in any directory, the same as writing logs
logs/**Everything inside logs, to any depth
a/**/ba/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.logRe-includes a file that an earlier pattern ignored
\#notesA file named #notes: a backslash escapes #, ! and trailing spaces
.gitignore patterns and what they match

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.

GroupTemplates
LanguagesNode.js, Python, Rust, Go, Java, Ruby
FrameworksNext.js, Vite, Remix, SvelteKit, Astro
Build and envEnv files, Vercel, Logs
InfrastructureDocker, Terraform
EditorsVSCode, JetBrains
Operating systemsmacOS, Windows, Linux
The 21 built-in templates

05 · Use cases

When to use the .gitignore Generator

  1. 01

    Bootstrap a fresh repo with a sensible .gitignore

  2. 02

    Add a new language to an existing repo without searching for the right template

  3. 03

    Get a .gitignore for a polyglot project where no single template fits

  4. 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?

'Pick stacks' uses 21 short templates written for this tool, covering the entries most projects need for each stack. They are much shorter than the full per-language files in the github/gitignore repository, which is linked below if you need exhaustive coverage. 'Describe with AI' asks an AI model to write a file for combinations the templates do not cover.

Is the order of entries significant?

Yes, in one case: a later rule can override an earlier one with the ! prefix. The VSCode template uses this to ignore everything in .vscode (.vscode/*) but keep settings.json and extensions.json. Sections appear in the order you pick them.

Should I commit .env files?

No. Commit .env.example with placeholder values and ignore .env and its .local variants. The 'Env files' template is selected by default, and the AI mode is instructed to always include those entries.

Why is package-lock.json or pnpm-lock.yaml not ignored?

Lockfiles should be committed: they pin dependency versions for reproducible installs. None of the built-in templates ignores a lockfile, and in AI mode our server removes any line that ignores a known lockfile (package-lock.json, pnpm-lock.yaml, yarn.lock, Cargo.lock, poetry.lock, Gemfile.lock, go.sum, .terraform.lock.hcl and a few others) before the result is returned.

Does it handle nested .gitignore files?

It generates one root-level file. Git also reads .gitignore files in subdirectories, which apply to their own subtree, so you can paste individual sections into a nested file where that suits the project.

How do I ignore a file that's already tracked?

A .gitignore entry only affects untracked files. Git keeps managing anything already in the index. Run git rm --cached path/to/file to untrack it while keeping it on disk, then commit. For a directory, add -r.

What happens to the description I type?

The description you type is sent to our server, which passes it to the Anthropic API to produce the result. The result is cached for 30 days under a hash of the description, so the same description returns the same answer. We keep per-IP rate-limit counters: 10 AI generations per hour and 50 per day, shared across the AI tools. Like every page on the site, this one loads page analytics (Vercel Analytics, Speed Insights and aside.so). 'Pick stacks' runs entirely in your browser and sends nothing.

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

Last updated .