Gitignore Generator

Build a .gitignore from 237 official github/gitignore templates. Merge languages, frameworks, IDEs and OS, then copy or download.

  • Runs in your browser
  • Tool input is not uploaded to ZeroTool servers
  • Free · No Sign-Up
Clear all removes selected templates, custom rules and the search, and clears this tool’s saved input. Ctrl/⌘+L does the same while focus is inside the tool.
Copy the complete merged file. Copy stays disabled until a template or nonblank custom rule produces output; retry directly if copying fails.
Download the complete current file as .gitignore with UTF-8 text. Templates are bundled locally; this action does not fetch or upload them.
.gitignore
Pick one or more templates above. The merged .gitignore appears here.
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

What is a .gitignore file?

A .gitignore file lists patterns Git should ignore — typically build artifacts, OS metadata, IDE caches, dependency directories, and secrets. Patterns follow gitignore glob syntax (*.log, build/, !keep-this.log) and apply per directory. Every Git repository should ship one to keep clones reproducible and prevent leaking environment-specific noise.

Common Stack Combinations

  • Full-stack JavaScript: Node + Nextjs + macOS + JetBrains
  • Python data project: Python + macOS + VisualStudioCode
  • Mobile native: Android + Java + Gradle + JetBrains + macOS
  • Static site: Node + Jekyll + macOS + VisualStudioCode
  • Go service: Go + macOS + VisualStudioCode + JetBrains

How merging works

Selected templates are sorted alphabetically and concatenated. For each template we emit a ### Name.gitignore header so you can trace which rules came from where. Identical rule lines across templates are dropped after the first appearance, but comments and blank lines are kept verbatim. Custom rules go last under ### Custom additions. The output starts with a small attribution header pointing back to ZeroTool and the github/gitignore source — remove it freely if you prefer a clean file.

Why a curated bundle

Crawling github/gitignore at request time would add network latency and rate-limit exposure. We snapshot the repository at build time, dedupe IDs, and ship the result as a single TypeScript module — predictable, auditable, and zero runtime dependencies. Refreshing pulls a new snapshot from upstream and replaces the bundle in one commit.

Example: Node + macOS + JetBrains + VS Code

Tick JetBrains, macOS, Node and VisualStudioCode, then add three custom lines: node_modules/, .env.local and coverage-html/. The output is 313 lines: the attribution header, the four templates in alphabetical order (### JetBrains.gitignore first), and a ### Custom additions block that contains only .env.local and coverage-html/. The custom node_modules/ line was dropped because the Node template already has the identical line.

.env.local stayed even though the Node template's .env.* already matches it. Deduplication compares the trimmed text of each line, not what the pattern matches.

Syntax Pitfalls, Checked with Git

With this .gitignore, git check-ignore -v (Git 2.56) reports:

logs/
!logs/keep.log
docs/*.pdf
build/
/secret.txt
  • logs/keep.log is still ignored by logs/. Git does not look inside an excluded directory, so the negation never applies (gitignore documentation). Write logs/* instead of logs/ if you need the exception.
  • docs/*.pdf ignores docs/a.pdf but not docs/notes/old.pdf: a slash in the middle anchors the pattern to the directory of the .gitignore file, and * does not cross /.
  • build/ matches build/ and src/build/ at any depth, but only directories.
  • /secret.txt matches the root file only; src/secret.txt is not ignored.

Files That Are Already Tracked

A new rule does not untrack files Git already tracks. Remove them from the index and commit; the files stay on disk:

git rm -r --cached node_modules/
git commit -m "Stop tracking node_modules"

This does not remove the files from earlier commits. If a secret was committed, rotate it; rewriting history (for example with git filter-repo) needs a force-push and fresh clones.

Limits

  • The bundle has 237 templates: 162 from the root of github/gitignore (languages and frameworks) and 75 from Global/ (editors, operating systems, tools). Templates under community/ are not included.
  • The templates are a snapshot taken when the bundle was last refreshed. Changes merged upstream after that appear only after the next refresh.
  • Deduplication removes repeated identical lines across the whole file. It does not merge equivalent patterns such as node_modules and node_modules/.

For .env files, use Env File Parser. For Apache rules, use .htaccess Generator. For crawler rules, use Robots.txt Generator.

FAQ

Where do the templates come from?

Every template ships from the official github/gitignore repository (CC0-1.0). We bundle the repository root — programming languages and frameworks — plus the Global/ subdirectory for IDEs, operating systems, editors, and build tools. The community/ subdirectory is intentionally excluded to keep quality predictable.

How are duplicate rules handled when I select multiple templates?

Each rule line is normalized (trimmed) and deduplicated across all selected templates. The first occurrence wins; later duplicates are silently dropped. Comments and blank lines are preserved so each section's provenance stays readable.

Can I add my own rules?

Yes. Open the 'Add custom rules' section below the templates and enter project-specific paths or globs. They are appended at the end under '### Custom additions' and participate in the same dedup pass.

How is this different from gitignore.io?

gitignore.io, now served at toptal.com/developers/gitignore, is a web service: both its page and its command-line API ask Toptal's server to build the file. This tool bundles github/gitignore (the repository root plus Global/) into the page and builds the file in your browser, so picking a template downloads nothing. Other differences: the interface comes in English, Chinese, Japanese and Korean, and the preview labels every section with the template it came from.

How often are the templates refreshed?

The bundle is regenerated on demand from the upstream repository and committed to source. Upstream changes a few times a month, so plan for periodic refreshes; existing templates rarely break compatibility because gitignore syntax is stable.

Are my selections and custom rules uploaded or saved?

They are not uploaded: the templates are bundled into the page and the file is built in this tab. The selected templates and your custom rules are saved in this browser's local storage so they come back on your next visit; Clear all, or Ctrl/⌘+L inside the tool, removes them. The page analytics record the tool name and action when you tick or untick a template (select, deselect), after a successful clipboard write (copy), or on download. Failed, pending or obsolete clipboard writes do not record copy. Template names and custom rules are not included.