.gitattributes Generator
Build line-ending, LFS and GitHub language rules — each one explained.
Rules are built visually and serialized in the order you add them, because Git resolves each attribute from the last matching pattern. Presets for cross-platform teams, Git LFS, GitHub language stats and lockfiles are idempotent. Inline explanations are emitted only as standalone comment lines — gitattributes has no inline comment syntax. Paste an existing file to import it, then copy or download the result as .gitattributes. Everything runs locally in your browser.
Worked examples
- Cross-platform line endings — Normalize text to LF in the index, pin Windows scripts to CRLF in the working tree, and treat images as binary. Put the catch-all first so later, more specific patterns win.
- Track large assets with LFS — Exactly the line `git lfs track "*.psd"` writes. Run `git lfs install` once per machine and renormalize already-tracked files.
- Fix GitHub language statistics — Linguist marks exclude vendored and generated paths from the language bar and override notebook detection. These attributes are GitHub-specific.
Rules
0 rule(s)Presets (idempotent)
.gitattributes
0 rule(s)Add a rule or choose a preset
The generated file appears here instantly.
Examples
Cross-platform team policy
* text=auto eol=lf
*.bat eol=crlf
*.png binary* text=auto eol=lf
*.bat eol=crlf
*.png binaryThe catch-all comes first so the more specific .bat and .png rules win for their paths — Git applies the last matching value per attribute.
LFS line for a Photoshop file
*.psd + Git LFS*.psd filter=lfs diff=lfs merge=lfs -textThe four tokens are the canonical output of git lfs track; import folds them back into a single LFS checkbox.
Language statistics for notebooks and minified assets
*.ipynb + linguist-language=Python
*.min.js + linguist-generated*.ipynb linguist-language=Python
*.min.js linguist-generatedGenerated files are excluded from GitHub's language bar regardless of a language override; use these marks to make stats reflect hand-written code.
About this tool
The .gitattributes Generator turns a visual list of path patterns and attributes into a ready-to-commit .gitattributes file. Pick text=auto, eol=lf or eol=crlf, binary, Git LFS, lockable, custom diff and merge drivers, and GitHub Linguist marks; each emitted rule is explained in one plain-language line. Rules stay in the exact order you add them because Git resolves every attribute from the last matching pattern — reordering behind the scenes would silently change what your file does.
Presets cover the recurring repo-hygiene jobs: a cross-platform team stack that normalizes to LF with CRLF exceptions for Windows scripts, an LFS starter set for media and model files, a GitHub statistics fix that marks vendored and generated trees, and a lockfile merge=union rule with an explicit warning about its risks. Applying a preset twice is harmless: a marker comment prevents duplicate blocks.
The import parser reads a file you already have, folds the four-attribute Git LFS line back into a single checkbox, preserves macros and block comments, and merges duplicate patterns with last-value-wins semantics. Export offers copy and an exact .gitattributes download. The renormalize checklist reminds you of the step most migrations forget: after changing line-ending rules, run git add --renormalize . and commit the result together with the file.
Everything happens in your browser. Repository paths are never uploaded, the generated file is inert configuration, and no credentials are ever placed in LFS rules — authentication belongs in Git's credential storage.
What this tool does not do
- The tool writes attributes only; it never edits .gitignore, which controls whether files are tracked at all.
- Patterns resolve relative to the directory containing the .gitattributes file, so presets assume the file lives at the repository root.
- Custom diff/merge/filter drivers need matching git config sections; the generated line alone does not define them.
- Linguist marks are GitHub-specific and may be ignored by other forges.
How to use this tool
Add your first rule
Type a path pattern such as *.png, choose attributes with the checkboxes, then click Add rule. Duplicate patterns merge with the newest attribute value winning.
Apply a preset or import a file
Use one of the four curated presets for common policies, or paste an existing .gitattributes and click Import file to hydrate the rule table.
Review conflicts and explanations
Conflicting or questionable rules surface as notices with concrete fixes. Standalone explanation lines are emitted above each rule — never inline, because Git would read an inline # as an attribute.
Copy or download, then renormalize
Copy the output or download it as .gitattributes, then follow the checklist: install Git LFS if needed, run git add --renormalize ., and verify with git check-attr.
Use cases
Stop line-ending churn
Standardize a mixed OS team on LF with explicit CRLF exceptions for Windows-only scripts, then renormalize tracked files once.
Correct GitHub language stats
Mark vendor and generated trees as vendored/generated and override notebook detection so the repository language bar reflects your code.
Track binary assets with LFS
Add filter/diff/merge=lfs and -text for PSD, ONNX or MP4 files before they bloat the repository history.
Document custom merge drivers
Assign merge=union to lockfiles and emit the matching git config snippet in your runbook, with a warning to review merged results.
Attribute forms this generator emits
| Input | Output token |
|---|---|
| Text normalization | text=auto |
| eol=LF / eol=CRLF | eol=lf / eol=crlf |
| Binary | binary |
| Git LFS | filter=lfs diff=lfs merge=lfs -text |
| Linguist marks | linguist-vendored / -generated / -language=X |
| Merge driver | merge=union |
Only a # at the start of a line is a comment in .gitattributes. Appending # explanation after a pattern would create bogus attribute names.
Common mistakes
Mistake:Placing the catch-all * rule after specific exceptions.
Fix:Git uses the last matching pattern for each attribute, so a later * text=auto eol=lf overrides an earlier *.bat eol=crlf. Put broad rules first.
Mistake:Adding an inline comment: *.txt eol=lf # normalize.
Fix:Only a # at the start of a line is a comment. Inline text becomes attribute names; use a standalone comment line above the rule instead.
Mistake:Expecting ! patterns to negate a match like .gitignore.
Fix:gitattributes has no negation: a leading ! is ignored with a warning. Write an explicit attribute override for the files you want to exempt.
Mistake:Forgetting to renormalize after adding text=auto or LFS rules.
Fix:Run git add --renormalize . and commit the result; otherwise already-tracked files keep their old line endings or remain stored inline.
Frequently asked questions
What does text=auto actually do?
Git detects whether a file looks like text and, if so, normalizes CRLF line endings to LF when the file is stored in the index. On checkout Git may restore the platform's native line ending depending on your core.autocrlf/eol settings. It does not rewrite binary files that merely lack a text attribute, and it does not change files already committed until you run git add --renormalize .
eol=lf vs core.autocrlf — which wins?
An explicit eol attribute for a path overrides core.autocrlf for that path's working-tree line endings. core.autocrlf remains the default for paths without an eol rule. Because attributes are per-path and last-match-wins, place broad defaults first and narrow exceptions later — a later `* eol=lf` silently overrides an earlier `*.bat eol=crlf`.
How do I stop GitHub counting my vendor code?
Add `vendor/** linguist-vendored` for third-party code and `docs/generated/** linguist-generated` for generated output, then commit the file. GitHub Linguist reads these attributes to exclude paths from the language bar and from the diff's generated-file collapse. They are GitHub-specific marks; other hosts may ignore them. Generated files are excluded regardless of any linguist-language override.
What lines does git lfs track add?
Exactly four attributes: `filter=lfs diff=lfs merge=lfs -text`. The generator emits that canonical line and folds it back into one Git LFS checkbox when you import an existing file. Run `git lfs install` once per machine, and renormalize already-tracked binaries so their content is actually replaced by LFS pointers.
Do I need to renormalize after adding .gitattributes?
Yes, if you changed text, eol, binary or LFS rules for files that are already tracked. Run `git add --renormalize .`, review the staged changes, and commit them with the .gitattributes file. Without that step the attributes apply to future writes only and you end up with mixed line endings or inline binaries in history.
Can I put an explanation after a rule on the same line?
No. In .gitattributes a `#` starts a comment only at the beginning of a line; `*.txt eol=lf # note` adds two bogus attribute names (`#` and `note`). This tool emits explanations as standalone comment lines above each rule, which Git parses correctly.
Is my repository data uploaded anywhere?
No. Rule building, import parsing and serialization all run in your browser. Pasted paths never leave the tab, and the download uses a local object URL with the exact filename .gitattributes.
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.
AI Function Calling Schema Generator
Generate function calling JSON schemas from TypeScript interfaces