.gitignore Generator
Build a clean, deduplicated .gitignore from 23+ of GitHub's own official templates. Pick your languages, frameworks, editor and OS, then copy or download in one click. Runs entirely in your browser — no signup, no upload, sources cited.
How it works
A .gitignorefile tells Git which paths to leave untracked, so generated junk and secrets never reach your history. Each line is a glob pattern matched against paths relative to the file's location. A trailing /means “directory”; * matches anything except a slash; ** matches across directories; a leading ! re-includes a previously ignored path; and lines starting with # are comments. The full grammar and precedence rules are defined in the official Git documentation cited below.
This tool is a deterministic template-merge engine, not a numeric calculator. It ships a version-pinned copy of 23templates taken verbatim from GitHub's public-domain github/gitignore collection — the same set behind the “Add .gitignore” dropdown when you create a repository. The build is pinned to commit dcc0fc7 so output is reproducible. Generation works in four steps:
- Order.Whatever order you click, selections are emitted in a stable sequence — Languages, then Frameworks, then IDEs & Editors, then Operating Systems — so the same picks always produce the same file.
- Assemble. For each template a
### name ###header (when grouping is on) is followed by that template's exact lines, then a blank separator. Custom rules you type are appended last under a### Custom ###section. - Deduplicate. When the toggle is on, the engine walks the merged lines top-to-bottom and keeps only the first occurrence of each identical pattern, dropping later copies and reporting the count. Comments, blank lines and negation rules (
!pattern) are never treated as duplicates — removing a later negation could change which files Git ignores, so the merge preserves Git's last-matching-pattern semantics. - Measure. The line count comes from
content.split("\n")and the byte size from the UTF-8 length of the text, shown live in the badge row. A separate cross-check function recomputes the duplicate count independently, so the “X duplicates removed” figure is verified, not estimated.
Nothing leaves your machine: the templates are bundled, so there are no GitHub API calls, no rate limits and no upload of your selections. Place the resulting file in your repository root and commit it before adding the files you want ignored.
Worked examples
Frequently asked questions
Sources & references
- github/gitignore — official template collection (CC0-1.0), pinned @ dcc0fc7
- Git SCM — gitignore reference (pattern syntax & precedence)
- Pro Git book — Recording Changes: Ignoring Files
Bundled templates were last cross-checked against github/gitignore at commit dcc0fc7 on 2026-06-23. The pinned commit is refreshed periodically as GitHub updates the upstream templates.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, want another template bundled, or have an edge case?
Email me at [email protected] — most fixes ship within 24 hours.