.gitignore Generator

Build a .gitignore for any combination of languages and stacks.

Open tool

Overview

Pick the languages, frameworks, IDEs, and operating systems your project touches, and get a ready-to-commit .gitignore that excludes the usual suspects - node_modules, __pycache__, bin/obj, .DS_Store, .idea, and friends. Each stack's patterns are grouped under labelled comment headers so you can see what came from where.

This is for developers who'd rather not hand-curate ignore patterns or chase down community templates every time they bootstrap a repository. Reach for it when starting a polyglot project, cleaning up an accumulated mess of stray patterns, or auditing what your current .gitignore actually covers.

How it works

Patterns follow the gitignore format documented in gitignore(5): leading slashes anchor to the repo root, trailing slashes match directories only, ** matches any number of path segments, and a ! prefix negates a previous rule. The generator concatenates curated pattern sets for each selected technology and de-duplicates overlapping entries (for example, .DS_Store appears once even when both macOS and a JavaScript template request it).

Patterns are evaluated by Git top to bottom, so the order of sections matters when negations are involved - the generator emits negations after their corresponding positive rule.

Examples

  • Node + macOS combo (excerpt):
    # Node
    node_modules/
    npm-debug.log*
    .npm/
    
    # macOS
    .DS_Store
    
  • .NET project (excerpt):
    # .NET
    bin/
    obj/
    *.user
    *.suo
    
  • Python + JetBrains IDE:
    # Python
    __pycache__/
    *.py[cod]
    .venv/
    
    # JetBrains
    .idea/
    *.iml
    
  • Negating a tracked build artifact:
    dist/
    !dist/.keep
    

FAQ

Where should the .gitignore live?

At your repo root. Git also reads nested .gitignore files in subdirectories, which override or extend parent rules for that subtree.

Will adding a pattern stop tracking files already committed?

No. Gitignore only applies to untracked files. Run git rm --cached <file> to untrack something that's already in the index.

How do I ignore a file globally for my user, not the repo?

Set core.excludesFile to a path like ~/.gitignore_global - useful for editor-specific patterns you don't want to push.

Why does my pattern not match?

Common pitfalls: a leading slash anchors to the repo root, and patterns without slashes match anywhere in the tree. Use git check-ignore -v <path> to see which rule (if any) is matching.

Try .gitignore Generator

An unhandled error has occurred. Reload ×