Gitignore Generator

Generates a .gitignore for your language and tooling, covering the build artefacts, dependency directories and editor files that should never reach a repository.

Live demo · real result from this tool

.gitignore

### Node.js #### Dependenciesnode_modules/.pnpm-store/.yarn/*!.yarn/patches!.yarn/plugins!.yarn/releases!.yarn/sdks!.yarn/versions # Logslogs/*.lognpm-debug.log*yarn-debug.log*yarn-error.log*pnpm-debug.log* # Build output and cachesdist/
build/
coverage/
.nyc_output/
.cache/
.eslintcache
.stylelintcache
*.tsbuildinfo

### Environment files (.env) ###
# Local environment files — commit .env.example instead
.env
.env.*
!.env.example

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

### Windows ###
# Windows
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.lnk

### VS Code ###
# VS Code (keep shared settings)
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

Ignoring a file does not untrack it: run git rm --cached <file> for files already committed. Lock files (package-lock.json, poetry.lock, Cargo.lock …) should be committed.

Processed on your device — nothing is uploaded.

How to use Gitignore Generator

  1. Pick your language, framework and editor.
  2. Review the generated rules and add anything specific to your project.
  3. Save it as .gitignore at the repository root, before the first commit if you can.
  4. Already-tracked files are unaffected — use git rm –cached to untrack them.
  5. Commit your lock files; ignoring them defeats the purpose of having them.
  6. Put OS and editor noise in a global excludesfile rather than the project’s ignore.

Ignoring a file does not remove it from history

This is the mistake that matters. Adding a path to .gitignore only stops Git tracking it from now on — a file already committed stays tracked, and stays in every previous commit forever. git rm --cached untracks it going forward and leaves the history intact. To remove something from history entirely you need git-filter-repo or BFG, and a force-push that rewrites every commit hash and breaks everyone’s clone. Which is why the only real answer for a committed secret is to rotate it.

The three categories worth ignoring

Dependencies that a manifest can reconstruct: node_modules, vendor, venv. Build output: dist, build, target, .next. And machine-specific files: .env, .DS_Store, .idea, editor swap files. The principle is that anything reproducible from what is committed, or specific to one developer’s machine, does not belong in the repository. Committing node_modules is the classic beginner error and makes every clone enormous and every diff unreadable.

Editor and OS files belong in a global ignore

Your .DS_Store and .idea/ are your problem, not the project’s — a colleague on Linux using Vim should not have to carry them in the repository’s ignore file. Configure a personal global gitignore with git config --global core.excludesfile and put OS and editor noise there once. The project’s .gitignore then covers only what the project genuinely produces, which keeps it short and reviewable.

Lock files are the exception people get wrong

package-lock.json, yarn.lock, Gemfile.lock, poetry.lock and Cargo.lock should be committed, not ignored. They pin exact dependency versions so that every developer and every CI run installs identical trees — which is the entire point of having them. The one debated case is a published library rather than an application, where some maintainers omit the lock file so consumers resolve their own versions.

Frequently asked questions

Does it cover multiple tech stacks at once?
Yes. Select as many stacks as your project actually uses and the tool merges every matching rule set into one file with duplicates removed.
Can I use this file directly in my repository?
Yes, as a starting point — review names, paths, and details against your actual project before committing.
Does generating this file upload anything to GitHub?
No. Everything is built client-side in your browser; nothing is sent anywhere until you commit it yourself.
Why is my file still tracked after adding it to .gitignore?
Because .gitignore only affects untracked files. Once something is committed, Git keeps tracking it. Run `git rm --cached <file>` to untrack it going forward — and note that it remains in the history.
How do I remove a committed secret?
Rotate it first — assume it is compromised the moment it was pushed. Removing it from history needs git-filter-repo or BFG plus a force-push that rewrites every commit and breaks existing clones, and even then forks and caches may retain it.
Should I commit package-lock.json?
Yes, for applications — it guarantees everyone installs the same dependency versions, which is what it exists for. Published libraries are the debated exception, where some maintainers omit it so consumers resolve their own.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close