Gitignore Generator
Build a .gitignore from 200+ official github/gitignore templates — pick languages, frameworks, IDEs, and OS, merge with deduplication, copy or download. Runs in your browser.
- Runs in your browser
- Your data never leaves your browser
- Free · No Sign-Up
Scan with WeChat to share this tool
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.logis still ignored bylogs/. Git does not look inside an excluded directory, so the negation never applies (gitignore documentation). Writelogs/*instead oflogs/if you need the exception.docs/*.pdfignoresdocs/a.pdfbut notdocs/notes/old.pdf: a slash in the middle anchors the pattern to the directory of the.gitignorefile, and*does not cross/.build/matchesbuild/andsrc/build/at any depth, but only directories./secret.txtmatches the root file only;src/secret.txtis 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 undercommunity/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_modulesandnode_modules/.
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?
Same upstream source (github/gitignore). Differences: four localized UIs (English / 中文 / 日本語 / 한국어), live preview with section-provenance comments, client-side execution (nothing leaves the browser), and a bundled offline-capable template set.
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.