Gitattributes Generator
Pick language presets, line-ending rules, and binary file handling to generate a ready-to-use .gitattributes file.
Use the Gitattributes Generator
Line-ending normalization
Language / framework presets
Binary file handling
Diff / merge settings
Custom lines (optional)
.gitattributes
Summary
This tool builds a .gitattributes file from language and framework presets, a line-ending normalization mode, binary file handling rules, and diff/merge settings. A .gitattributes file keeps line endings consistent across contributors on different operating systems, stops Git from trying to diff binary assets as text, and tells GitHub which files to treat as generated or vendored. Pick the presets that match your project, review the output, then copy it or download it as .gitattributes and drop it in your repository root.
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-09-09 · Reviewed by Nham Vu