Gitattributes Generator
Pick language presets, line-ending rules, and binary file handling to generate a ready-to-use .gitattributes file.
Line-ending normalization
Language / framework presets
Binary file handling
Diff / merge settings
Custom lines (optional)
.gitattributes
Summary
Pick language presets, line-ending rules, and binary file handling to generate a ready-to-use .gitattributes file.
How it works
- Choose a line-ending mode: auto-detect (recommended), force LF, force CRLF, or none.
- Check the language and framework presets your project uses.
- Check the binary file categories you want Git to stop treating as text.
- Check any diff and merge settings you want, such as a Markdown diff driver or marking vendor folders as generated.
- Optionally add custom lines in the text box for anything not covered by a preset.
- Copy the generated text or download it as .gitattributes and place it in your repository root.
Use cases
- Stop "every line changed" diffs caused by mixed LF/CRLF line endings on a team with Windows and Mac contributors.
- Prevent Git from corrupting binary assets like images or fonts by treating them as text.
- Mark lockfiles and minified bundles as generated so they collapse in GitHub pull request diffs.
- Use a language-aware diff driver so changed function names show up correctly in diff hunks.
- Exclude test and doc folders from git archive exports with export-ignore.
- Bootstrap a new repository with sane defaults instead of copying rules from memory.
Frequently Asked Questions
Last updated: 2026-07-23 ·
Reviewed by Nham Vu