Gitattributes Generator
Generate a .gitattributes with line-ending, binary and diff rules.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Generated a .gitattributes with 18 rule(s).
How it works
- Normalized text files to lf with `* text=auto eol=lf`.
- Marked 3 binary extension(s) and 2 LFS extension(s).
- Marked lockfiles as non-diffable so they do not produce noisy diffs.
- Apply the file with `git add --renormalize .` after changing the line-ending rule.
- The file is a starting point: review it before committing.
Methodology
- Emit the requested text-normalization rule (`* text=auto eol=<lf|crlf>`).
- Expand each binary and LFS extension into a `*.<ext>` rule.
- Add lockfile, linguist-generated and platform line-ending rules, then de-duplicate in emit order.
Usage
- Choose the line-ending normalization and whether lockfiles are binary.
- List any binary or Git LFS extensions.
- Run the generator and copy or download the .gitattributes.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
LF normalization with images and LFS
{
"normalize": true,
"eol": "lf",
"binaryExtensions": "png, jpg, pdf",
"lockfiles": "binary",
"linguistGenerated": true,
"lfsExtensions": "psd, zip"
}Minimal attributes
{
"normalize": true,
"eol": "crlf",
"binaryExtensions": "",
"lockfiles": "text",
"linguistGenerated": false,
"lfsExtensions": ""
}Limitations
Why line endings need an explicit rule
Windows and Unix editors disagree about line endings. A `* text=auto eol=lf` rule makes Git store one canonical form in the repository so diffs stay stable across platforms.
Binary and LFS extensions are marked explicitly because Git cannot always detect them, and a misdetected image corrupts on checkout when it is normalized as text.
Frequently asked questions
- Will this convert my existing files?
- No. A .gitattributes controls how Git treats files from now on; existing tracked content is only renormalized when you run `git add --renormalize .`.
- Why mark lockfiles as binary?
- Lockfiles change wholesale and are hard to review line by line. Marking them `-diff` keeps them out of diffs; leave them as text if you prefer readable diffs.
Sources
- gitattributes(5) — Git documentation — Git project
- git-lfs — Git Large File Storage — Git LFS
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.