Skip to content

Gitignore Generator

Pick the languages, frameworks, editors and operating systems in your project and get a combined .gitignore file.

Runs in your browserFree, no sign-up

Settings

Results update automatically as you type.

.gitignore

# Generated by PlainToolbox — https://plaintoolbox.com/gitignore-generator

# Node
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
.pnpm-store/
dist/
build/
.next/
.nuxt/
.cache/
coverage/
*.tsbuildinfo

# VS Code
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
*.code-workspace

# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
.Spotlight-V100
.Trashes

# Environment & secrets
.env
.env.local
.env.*.local
*.pem
*.key
secrets.json

Summary

Sections
4
Patterns
29

What Gitignore Generator does

A .gitignore file tells Git which paths it should never track — build output, dependency folders, editor settings and anything holding a secret. This generator combines the standard patterns for the languages, editors and operating systems you actually use into one commented file, so you are not pasting five separate templates together and hoping they do not conflict. Each section is labelled, which matters more than it sounds: six months later, when a file you expected to commit is being ignored, a commented file tells you immediately which rule is responsible rather than leaving you to bisect a wall of patterns.

When you would reach for this

Starting a new repository

Getting the ignore rules right before the first commit avoids ever having to rewrite history to remove a file that should never have been tracked.

Cleaning up a messy repo

If node_modules or a build folder is already tracked, add the rule here and then run git rm -r --cached on that path to stop Git following it.

Onboarding a mixed-editor team

Covering both VS Code and JetBrains stops contributors' editor settings appearing in every diff and starting arguments that have nothing to do with the code.

Keeping secrets out of history

The environment section ignores .env files, private keys and certificates — the category of mistake that is hardest to undo once pushed.

Step by step

  1. 1

    Tick every language or framework the repository uses — it is normal for a project to need two or three.

  2. 2

    Add the editors your team works in, so one person's .idea or .vscode folder never lands in the repo.

  3. 3

    Tick the operating systems people contribute from, which keeps .DS_Store and Thumbs.db out of pull requests.

  4. 4

    Download the file into the repository root, or copy the contents into an existing .gitignore.

Why .gitignore cannot rescue a file you already committed

The rules in .gitignore apply only to untracked files. Once Git is tracking a path, it keeps tracking it no matter what patterns you add afterwards, which is the single most common source of confusion with this file. To stop tracking something that is already committed, run `git rm --cached <path>` — this removes it from the index while leaving your working copy intact — and then commit that removal. It is worth being clear about what this does and does not achieve: the file stops appearing in future commits, but every previous commit that contained it still does. Anyone who clones the repository gets the whole history, so a password committed last month remains readable even after the file is removed today. Genuinely purging a secret requires rewriting history with a tool such as git-filter-repo, and — because the old commits may already exist on other machines and on the host — treating the credential as compromised and rotating it.

How pattern matching works

A pattern with no slash matches at any depth, so `build` ignores a build directory anywhere in the tree. A leading slash anchors the pattern to the directory containing the .gitignore, so `/build` ignores only the one at the root. A trailing slash restricts the match to directories, which is why `build/` will not accidentally ignore a file named build. An exclamation mark negates an earlier rule, and this is how the VS Code section works: it ignores everything in .vscode and then re-includes the two files a team genuinely wants to share. Negation has one limitation worth knowing — you cannot re-include a file if one of its parent directories is excluded, because Git never descends into an ignored directory to discover what is inside it. When a negation rule appears to do nothing, an over-broad directory rule above it is almost always the reason.

A few pointers

  • Commit a .env.example with the keys but no values, so new contributors know what to set without a secret ever entering the repo.
  • Run `git check-ignore -v <path>` to find out exactly which line in which file is causing a path to be ignored.
  • A global ignore file set with `git config --global core.excludesfile` is the right place for your personal editor preferences, rather than pushing them into every project.

Frequently asked questions

Where does the .gitignore file go?
In the root of the repository, alongside the .git folder. You can also place additional .gitignore files inside subdirectories, and their rules apply to that directory and everything below it.
Why is Git still tracking a file I just added to .gitignore?
.gitignore only prevents untracked files from being added. Once a file is tracked, Git keeps following it — run `git rm --cached <file>` to stop tracking it, then commit that change.
Should I commit .env files?
No. Environment files usually hold API keys, database passwords and tokens, and anything committed to Git stays recoverable in history even after deletion. Commit a .env.example with blank values instead.
Should Cargo.lock or package-lock.json be ignored?
Lock files should be committed for applications, so every install resolves to identical versions. The common exception is Rust libraries, where Cargo.lock is traditionally ignored so downstream consumers control resolution.

Further reading

Looking for something else? Browse all developer tools or see every tool.