Gitattributes Generator
Generate cross-platform .gitattributes configurations with normalized line endings, Git LFS tracking, and binary guards.
Global Line Endings Strategy
Tech Stack & Filetype Presets
Git Large File Storage (Git LFS)
Custom Pattern Rules
Generated .gitattributes (28 rules)
Renormalize Existing Repository
After creating or updating .gitattributes, commit existing files with updated line endings:
git add --renormalize .Do it offline:$
How to use it
- Select your repository-wide line ending strategy (auto-detect with LF checkout is recommended for cross-platform teams).
- Select tech stacks relevant to your project (Web / TS / React, Python, C# / .NET, or Common Binary Assets).
- Toggle Git Large File Storage (LFS) and adjust tracked binary extensions (e.g., *.psd, *.mp4, *.onnx, *.blend).
- Add custom glob pattern overrides (such as marking generated files with linguist or suppressing minified file diffs).
- Copy the generated .gitattributes file into your repository root and renormalize existing files with git add --renormalize .
Generate cross-platform .gitattributes configurations with automatic line-ending normalization (LF/CRLF), Git LFS asset tracking, diff suppression on minified files, and binary merge guards.
How it works
Git uses .gitattributes to determine how files should be checked out into your working directory and committed to the object store.
The directive * text=auto eol=lf ensures all text files have LF line endings in the repository, eliminating git status noise caused by Windows CRLF vs Linux LF differences.
Binary guards prevent Git from attempting to merge or diff media files, fonts, and compiled binaries, avoiding merge conflict corruption.
Lockfile binary merge directives (such as merge=binary on package-lock.json or pnpm-lock.yaml) force developers to rerun the package manager rather than producing invalid JSON merge conflict markers.
Examples
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Common errors
FAQ
Why does git show every line modified when switching OS?
Windows editors use Carriage Return + Line Feed (CRLF, \r\n), while macOS and Linux use Line Feed (LF, \n). Without a .gitattributes specifying eol=lf or text=auto, git checkout may swap line endings, making every line appear modified across operating systems.
How do I renormalize an existing repo after adding .gitattributes?
Run 'git add --renormalize .' in your repository root, followed by 'git commit -m "Normalize line endings"'. This updates Git's index with normalized line endings without changing commit history.
Why should lockfiles be marked with merge=binary?
When Git attempts three-way textual merges on JSON or YAML lockfiles, it often produces invalid syntax and broken dependency trees. Marking them with merge=binary forces clean developer-side resolution via npm install or pnpm install.