Menu

.gitignore Generator

Build a clean .gitignore for any stack — languages, frameworks, IDEs, and OS.

Last updated

Quick stacks
Pick templates2 selected

Languages

Frameworks

Editors & IDEs

Operating Systems

.gitignore · 37 lines
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
.pnpm-store/
.npm
.yarn-integrity

# Coverage
coverage/
*.lcov
.nyc_output

# Build output
dist/
build/

# Environment
.env
.env.local
.env.*.local

# macOS
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

What is a .gitignore generator?

Every Git repository needs a .gitignore file. It is the plain-text list of paths Git should *not* track — build artifacts, dependency folders, IDE config, OS junk like .DS_Store. Without it, your first commit accidentally drags in node_modules/, .env, and target/, and undoing that mess is far more annoying than getting the file right up front.

Each ecosystem ignores different things, and most projects span several at once. A typical Node + TypeScript app on a macOS laptop with VS Code already needs the union of four different ignore lists. Writing this by hand from memory means you forget coverage/, leak a .env, or commit a stray .idea/ from a teammate's JetBrains setup.

So this generator bundles curated templates from the canonical github/gitignore project — the same rules behind the official GitHub auto-suggestions — and lets you stack them together. Check the boxes that apply, and you get one deduplicated .gitignore to paste straight into your repo. No accounts, no uploads, runs entirely in your browser.

What you'll learn while building your .gitignore

  • .gitignore patterns use glob syntax: *.log ignores every log file, build/ ignores a folder, !important.log un-ignores a specific file even if a glob matches it.
  • Patterns apply relative to the location of the .gitignore file — so a .gitignore inside src/ only affects files under src/.
  • Already-tracked files are **not** retroactively ignored. If you commit node_modules/ and then add it to .gitignore, you still need to git rm -r --cached node_modules to untrack it.

How to generate a .gitignore step by step

  1. Pick a quick-stack preset (optional)

    If your project matches a common combination — Next.js, Django, Rails — click a preset to tick all the relevant boxes at once. Then prune or add a couple more if you have extras.

  2. Add your languages

    Every language has artifacts to ignore: Node has node_modules/, Python has __pycache__/ and virtualenvs, Java has target/ and .class files. Pick the languages your project actually compiles.

  3. Add your frameworks

    On top of the language rules, frameworks add their own build directories: Next.js wants .next/ and .vercel, Django wants staticfiles/ and db.sqlite3, Rails wants tmp/ and /storage/*. Tick the framework if you use it.

  4. Add your editors and OS

    Add the editor templates the **team** uses (not just you) — if anyone uses JetBrains or Vim, include them. Then add the operating systems on your team: macOS dumps .DS_Store, Windows dumps Thumbs.db, both are easy to commit by accident.

  5. Copy or download

    The right panel shows the combined, deduplicated output. Hit **Copy** to paste it straight into a .gitignore at your repo root, or **Download** to save the file directly.

.gitignore syntax quick reference

The patterns you'll write most often. Full reference at git-scm.com/docs/gitignore.

PatternMeaningExample
node_modulesIgnore a file or folder with this exact name, anywhere in the treeMatches both /node_modules and src/node_modules
node_modules/Trailing slash — match a **folder** only, not a same-named fileWon't match a file accidentally named node_modules
/buildLeading slash — anchor to the .gitignore directory onlyMatches /build but not src/build
*.logGlob — match any file ending in .logMatches error.log, debug.log, logs/foo.log
!important.logNegation — un-ignore a specific file matched by an earlier rulePair with *.log to keep one log file tracked
docs/**/draftDouble-star — match draft in any subfolder of docs/Matches docs/v1/draft and docs/2025/q1/draft
# commentComment — lines starting with # are ignored by GitGroup rules with section headers like # Node.js

.gitignore examples to try

A minimal Node.js + macOS .gitignore

What every Node project on a Mac needs

# Node.js node_modules/ npm-debug.log* dist/ .env .env.local # macOS .DS_Store ._*

The bare minimum for any Node project shared with a teammate on macOS. Even a tiny side project should have these rules — without .DS_Store and node_modules/ you'll fight pointless conflicts.

Python + Django + JetBrains

Common server-side Python stack

# Python __pycache__/ *.py[cod] .venv .pytest_cache/ # Django *.log local_settings.py db.sqlite3 media/ staticfiles/ # JetBrains .idea/ *.iml

A typical Django backend developed in PyCharm. Note the local db.sqlite3 is ignored — production never uses it, and committing it leaks dev data and breaks teammates' fresh clones.

Override a rule with a negation

Ignore all logs except one

*.log !keep-me.log

The first line ignores every .log file. The !keep-me.log rule then re-includes that one specific file. Negations only work for files an earlier rule actually ignored — you can't un-ignore a file inside an ignored folder.

Common .gitignore mistakes

  • Adding .gitignore after the fact and expecting committed files to disappear. They don't — you have to git rm -r --cached <path> to untrack them.
  • Committing a .env once. Even one commit leaks the secret forever in your repo history. Add .env* to .gitignore **before** the first commit, and rotate any secret that did slip in.
  • Forgetting OS-specific noise on shared repos. If even one teammate is on macOS and the repo has no .DS_Store rule, those files will appear in every PR diff and slow down review.

.gitignore Generator FAQ

Where do these .gitignore templates come from?
The templates are condensed from the open-source github/gitignore project — the same source GitHub uses when you tick "add .gitignore" while creating a new repo. We trimmed each one to the rules teams actually need and grouped them by category.
Do I commit the .gitignore file itself?
Yes. .gitignore is meant to be version-controlled and shared with your team. It is the *contract* about what should and shouldn't be tracked. The exception is personal preferences (e.g. your editor of choice) — those belong in your global ~/.gitignore_global.
How do I un-track a file that's already been committed?
Add it to .gitignore first, then run git rm --cached <path> (or git rm -r --cached <folder>) to remove it from the index without deleting it on disk. Commit both changes together so teammates see the update.
Can I have multiple .gitignore files in one repo?
Yes. Git looks for a .gitignore in each directory and applies the rules to that subtree. This is useful for monorepos where the frontend and backend have very different ignore rules — keep root-level rules for shared OS/editor noise and put language rules in each package's directory.
What's the difference between .gitignore and .git/info/exclude?
.gitignore is committed and shared with the team. .git/info/exclude lives only in your local clone and is for personal exclusions you don't want to push. For exclusions across all of your repos, use a global ~/.gitignore_global instead.

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED