DevPlainly

.gitignore Generator

Pick the languages, frameworks, editors and operating systems your project uses. The generator combines the templates and removes duplicate patterns, ready to copy or download.

Languages
Frameworks
Tools
Editors
Operating systems

.gitignore

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

# Secrets & .env files
.env
.env.*
!.env.example
*.pem
*.key

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

# macOS
.DS_Store
.AppleDouble
.LSOverride
._*

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

What should go in a .gitignore?

A good .gitignore keeps three kinds of files out of your repository:

  • Generated files: dependencies (node_modules/, .venv/), build output (dist/, .next/, target/) and caches.
  • Personal files: editor settings and OS clutter such as .DS_Store or Thumbs.db.
  • Secrets: .env files, private keys and credentials. See how to use .env files safely.

Pattern syntax in 30 seconds

  • *.log ignores every file ending in .log, in any folder.
  • build/ ignores folders named build (the trailing slash means directories only).
  • /config.local with a leading slash matches only at the repository root.
  • **/temp matches temp in any subfolder.
  • !.env.example re-includes a file that an earlier pattern ignored.

Already committed a file you now want to ignore?

Adding it to .gitignore does not remove it from the repository. Stop tracking it with git rm --cached path/to/file and commit. If the file contained a password or API key, rotate that secret — it is still in the Git history. More in how to undo almost anything in Git.

Global gitignore for your machine

OS and editor files are better ignored once for all your projects: git config --global core.excludesFile ~/.gitignore_global, then put patterns like .DS_Store in that file.