.gitignore Generator
Pick your stack, OS, and editor — get a combined .gitignore with duplicates removed.
# Node node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* .pnpm-store/ *.tsbuildinfo .npm .eslintcache # macOS .DS_Store .AppleDouble .LSOverride Icon ._* .Spotlight-V100 .Trashes # VS Code .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json *.code-workspace # Secrets / env .env .env.local .env.*.local *.pem *.key secrets.json credentials.json .aws/ .ssh/
How to Use
- 1. Select your language, framework, operating system, and editor.
- 2. Add any project-specific rules of your own.
- 3. Review the combined output — duplicates are removed automatically.
- 4. Download it as
.gitignoreinto your repository root.
What Belongs in .gitignore
Three categories of file should never be committed: anything generated (build output, compiled binaries, dependency folders), anything local to one machine or editor, and anything secret. Everything else belongs in version control.
The secrets category is the one that causes real damage. A committed .env file stays in your Git history even after you delete it, and scrapers actively watch public repositories for exactly that pattern. Rotating the leaked key is usually faster than rewriting history.
Patterns are relative to the file's location, so a leading slash anchors a rule to the repository root — /dist ignores only the top-level folder, while dist/ ignores one at any depth. A leading ! re-includes something an earlier rule excluded, which is how the VS Code template ignores personal settings while keeping shared ones tracked.
One common trap: .gitignore only affects files Git is not already tracking. If a file is already committed, add the rule and then run git rm --cached <file>.
Related: Mock Data Generator, cURL to Code, and Chmod Calculator.
Frequently Asked Questions
What does a .gitignore file do?
It tells Git which files to leave untracked — build output, dependency folders, editor settings, and secrets. Without one, a single `git add .` can commit your entire node_modules folder or an API key.
Can I combine several templates?
Yes, and you usually should — a typical project needs its language, its framework, your operating system, and your editor. Overlapping rules are de-duplicated so the file stays readable.
What does the ! prefix mean?
It negates a previous rule, re-including a file that an earlier pattern excluded. The VS Code template uses this to ignore the .vscode folder while still tracking shared settings like launch.json.
Why is .env always worth including?
Environment files hold database passwords, API keys, and tokens. Committing one — even to a private repo — puts those secrets in your history permanently, and removing them later requires rewriting every commit that touched the file.
It is not ignoring a file I already committed
Git only applies .gitignore to untracked files. For something already tracked, run `git rm --cached <file>` and commit that change; the ignore rule then takes effect from there on.