Skip to content

Menu

Gitattributes Generator

Generate .gitattributes files

Runs entirely in your browserGit & GitHubFree, no sign-up
Loading tool

01What is Gitattributes Generator?

A .gitattributes file tells Git how to treat each path: whether it is text or binary, which line endings to use on checkout, and which diff or merge driver to call. Getting it right early saves a lot of noisy pull requests. This tool gives you a working starting point for six project types: Web Application, Node.js, Python, Unity, Rust and Go. Each template is a fixed block of rules that follows the syntax in the official gitattributes documentation. Five of them open with * text=auto. That line lets Git detect text files and store them with LF line endings in the repository, while your working copy can still use the local convention. Source files are then marked text, and several get a built-in diff driver such as diff=python, diff=rust, diff=golang, diff=html, diff=css or diff=csharp. Those drivers make Git's hunk headers show the enclosing function or class, which is handy in code review. Images, fonts, archives, compiled libraries and data files like .pkl, .npy and .parquet are marked binary. In Git, binary is shorthand for -diff -merge -text, so Git will not normalise them or try to show a text diff. Some templates add their own touches. Node.js forces eol=lf on Markdown, YAML, .env files, Dockerfile and the Git config files, and marks package-lock.json, yarn.lock and pnpm-lock.yaml as -diff. Rust does the same for Cargo.lock. The Unity template has no text=auto line. It routes scenes, prefabs, materials and .meta files to merge=unityyamlmerge with eol=lf. A quick example: choose Rust and type *.psd filter=lfs diff=lfs merge=lfs -text into Custom Rules. The output is the Rust template, then a blank line, a # Custom rules heading and your line. Custom text is trimmed at both ends but otherwise copied exactly as you wrote it. There are honest limits here. You get one template at a time, so to combine Node.js and Python rules you paste the extra lines into Custom Rules. The tool does not validate your custom patterns. It also cannot register merge drivers, because the unityyamlmerge entry only works once UnityYAMLMerge is set up in your Git config. And marking a file binary does not shrink your repository, which is what Git LFS is for. The file is assembled from text bundled with the page, so your custom rules never leave the tab.

Repository maintainers on cross-platform teams and Unity developers who want clean diffs, stable line endings and working scene merges. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Gitattributes Generator

  1. Click a Project Type button such as Node.js or Unity.
  2. Add any extra patterns in Custom Rules (optional), for example *.sh text eol=lf.
  3. Review the preview, then Copy it.
  4. Save it as .gitattributes in the repository root and commit it.

03Worked examples

Input: Project Type: Node.js
Result: * text=auto … *.md text eol=lf *.yml text eol=lf *.yaml text eol=lf … *.env text eol=lf .editorconfig text eol=lf .gitattributes text eol=lf .gitignore text eol=lf Dockerfile text eol=lf … package-lock.json -diff yarn.lock -diff pnpm-lock.yaml -diff … *.woff2 binary
The Node.js template marks package-lock.json, yarn.lock and pnpm-lock.yaml with -diff so git shows them as binary changes instead of huge text diffs.
Input: Project Type: Unity
Result: # Unity *.cs diff=csharp text … *.mat merge=unityyamlmerge eol=lf *.anim merge=unityyamlmerge eol=lf *.unity merge=unityyamlmerge eol=lf *.prefab merge=unityyamlmerge eol=lf *.asset merge=unityyamlmerge eol=lf *.meta merge=unityyamlmerge eol=lf *.controller merge=unityyamlmerge eol=lf … *.dll binary *.exe binary
Unity YAML assets (.prefab, .unity, .meta and others) are routed to the unityyamlmerge merge driver, which you still have to register in your git config.
Input: Project Type: Rust; Custom Rules: *.psd filter=lfs diff=lfs merge=lfs -text
Result: * text=auto # Source … Cargo.lock -diff … # Custom rules *.psd filter=lfs diff=lfs merge=lfs -text
Custom rules are trimmed and appended after a blank line under "# Custom rules".
Input: Project Type: Go
Result: * text=auto # Source *.go text diff=golang *.mod text *.sum text *.yml text *.yaml text *.md text # Binary *.exe binary *.test binary *.out binary
The Go template sets diff=golang on *.go files so git uses Go-aware hunk headers.
Input: Project Type: Python
Result: * text=auto # Source *.py text diff=python … # Notebooks *.ipynb text eol=lf # Binary *.pkl binary … *.parquet binary
Trimmed. Notebooks are kept as text with LF endings, while pickles, HDF5, NumPy and Parquet files are binary.

04Common use cases

  • Fixing CRLF versus LF churn in a repo shared by Windows and macOS developers
  • Stopping package-lock.json and pnpm-lock.yaml from cluttering pull request diffs in a Node project
  • Setting up Unity Smart Merge for scene and prefab files in a game repo
  • Marking pickled models, NumPy arrays and Parquet files as binary in a Python ML repository
  • Making Dockerfiles and .env files always check out with LF so container builds work on Windows
  • Getting Go-aware or Rust-aware hunk headers in git diff output during code review
  • Adding Git LFS tracking lines for design files on top of a language template

05Tips

  • After adding the file to an existing repo, run git add --renormalize . so tracked files pick up the new line-ending rules.
  • unityyamlmerge only works once UnityYAMLMerge is configured as a merge driver in your Git config; the attribute alone isn't enough.
  • Use Git LFS attributes (filter=lfs) for large binaries; binary only stops diffing, it doesn't reduce repo size.
  • Mark *.bat and *.cmd with eol=crlf if Windows scripts must keep CRLF.

06Related concepts

.gitattributes, Line endings, Git LFS, Diff drivers, Merge drivers.

Frequently Asked Questions

What is Gitattributes Generator?

Gitattributes Generator is a free, browser-based developer tool on AIDToolStack. Generate .gitattributes files It requires no installation or sign-up and works entirely in your browser.

Is Gitattributes Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Gitattributes Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe