DevTools Logo

Gitignore Generator

.gitignore Generator

Build a fresh .gitignore or audit an existing one against 55+ official templates

Templates

3 selected · 0 official templates from github/gitignore

Loading templates…

Examples

Ignore Node.js project output

Input
template: Node
Output
# Dependencies
node_modules/

# Build output
dist/
build/

# Environment
.env
.env.local

# OS / editor
.DS_Store
.vscode/

A Node template skips installed dependencies, build artifacts, local env files, and common OS/editor junk.

Combine multiple stacks

Input
templates: Node, macOS
Output
node_modules/
dist/
.env

# macOS
.DS_Store

Stacks merge into one file so a polyglot repository ignores the output of every language it uses.

About this tool

Select the technologies in your stack — Node, Python, Java, macOS, VSCode and dozens more — and the generator merges the official github/gitignore templates into one file. Patterns shared across selections are deduplicated, and each section carries a comment naming its source template.

The output follows standard gitignore syntax: * matches any string within one path segment, ** crosses directory levels, a leading ! negates an earlier rule (Node's template keeps .env.example while ignoring other .env files this way), and a trailing slash pins a pattern to directories, so build/ never hides a file named build.

Audit mode reviews an existing file: paste your current .gitignore, select the stack, and the tool flags expected patterns that are missing, duplicates and overlapping variants, outdated leftovers, and lines that cannot work — such as a negation whose parent directory is already ignored. A one-click corrected file applies the findings.

How to use this tool

  1. Select your stack

    Search the list and tick every language, framework, editor or OS the project touches.

  2. Copy the generated file

    The merged, deduplicated file updates as you choose; save it at the repository root.

  3. Audit an existing file

    Switch to the Audit tab, select the same stack, and paste your current file.

  4. Apply the suggested fixes

    Review the missing, redundant and outdated findings, then copy or download the corrected file.

Use cases

Bootstrapping a new repository

Generate a sensible .gitignore for your stack on day one so build output and secrets never get committed.

Adding a stack to an existing project

Append ignore rules when you introduce a new language or tool (e.g. adding Python to a JS repo) without hand-writing patterns.

Keeping secrets out of history

Ensure .env and credential files are ignored before the first commit, since removing them later doesn't erase prior history.

Template categories

CategoryExamples
LanguagesNode, Python, Go, Rust, Java, C++, Ruby, Swift, Kotlin, Elixir
FrameworksRails, Laravel, Symfony, Unity, UnrealEngine, Godot, Terraform
EditorsVisualStudioCode, JetBrains, Vim, Emacs, SublimeText, Xcode
OSesmacOS, Windows, Linux
CustomEnvironment (.env) and Logs

Templates are bundled from github/gitignore (CC0-1.0) — no runtime network call.

Common mistakes

Mistake:Committing a file before adding it to .gitignore.

Fix:Git only ignores untracked files. If a file is already tracked, add the pattern then run `git rm --cached <file>` so Git stops tracking it.

Mistake:Using a trailing slash incorrectly.

Fix:A trailing slash matches a directory (build/) but not a same-named file. Omit the slash only when you mean both a file and a folder.

Mistake:Expecting global ignore rules to cover sensitive files automatically.

Fix:Templates cover common output, not your custom secrets. Add any private config or key files explicitly, and verify with `git status` before pushing.

Frequently asked questions

Why is a file still tracked after adding it to .gitignore?

Git applies ignore rules only to untracked files; a committed path is unaffected by the rule. Run git rm --cached <file> to stop tracking it while keeping your local copy, then commit that removal together with the new rule.

How do I ignore everything except one file?

Ignore broadly, then negate the exception: * followed by !keep.txt skips everything but that file. Git does not descend into ignored directories, so the directory itself must stay un-ignored for the negation to reach files inside it — the audit flags this case.

Should I commit .env files?

No. These files hold credentials and connection strings that must never enter history, and the templates here exclude them. Commit the sanitized .env.example instead — the Node template keeps it tracked with a ! rule — and rotate any secret that was ever pushed, as it survives in past commits.

Can I combine several templates?

That is the default: every template you tick merges into one file, with shared patterns emitted once and sections labelled by source. A web project might combine Node, macOS and VSCode; polyglot repositories add more.

References & standards