DevKit
Generator

.gitignore Generator

Generate .gitignore files for popular languages and frameworks.

Last updated: August 2026

Share:

Was this tool helpful?

Keeping the wrong files out of your repo

A .gitignore file tells Git which paths to leave untracked. It exists because every project accumulates files that should never be committed: dependency folders that can be reinstalled, build output that is regenerated, editor settings that are personal, and secrets that must never leave your machine. A generator assembles a sensible starting file for your language and tooling so you do not forget a critical entry.

The patterns are glob-style. A trailing slash matches a directory, a leading slash anchors to the repo root, an asterisk matches within a path segment, and a leading ! re-includes something you otherwise excluded.

A realistic Node example

# Dependencies
node_modules/

# Build output
dist/
.next/

# Environment secrets
.env
.env.local

# OS and editor cruft
.DS_Store
.vscode/

# Logs
*.log

The .env entries are the ones that matter most: committing an environment file with API keys is one of the most common and costly mistakes, and leaked keys often get scraped within minutes of a push.

Questions that keep coming up

Why is a file still tracked after I ignore it? .gitignore only affects untracked files. If you already committed something, Git keeps tracking it. Remove it from the index with git rm --cached path and commit; the file stays on disk but leaves the repo.

Should I ignore the lock file? No. Dependency lock files like package-lock.json should be committed so everyone installs identical versions. Ignore the installed node_modules folder, not the lock file that describes it.

How do I ignore everything except one file in a folder?Ignore the folder with build/*, then re-include the file with !build/keep.txt. Order matters, and you cannot re-include a file if its parent directory is fully ignored, so exclude the contents rather than the directory itself.