Set up correct line ending rules for a project that runs on both Windows and Mac or Linux machines.
Ensure GitHub shows proper syntax highlighting for your project's file types.
Audit your repository to find file types that have no .gitattributes rule yet, using the included check.sh script.
Quickly generate a ready-to-use .gitattributes file by combining templates via one of the linked online tools.
No installation needed. Copy the relevant template file into your project root as .gitattributes, or use one of the linked online generator tools to combine templates automatically.
This repository is a collection of template files for Git's .gitattributes system. A .gitattributes file sits in the root of a code project and tells Git how to handle specific types of files: whether to treat them as text or binary, how line endings should be managed across different operating systems, and how files should be identified for things like syntax highlighting on GitHub. Without these instructions, Git sometimes makes wrong guesses that cause files to appear changed when nothing meaningful actually changed. The project is modeled after the well-known .gitignore templates collection, which does a similar job for telling Git which files to ignore entirely. Here the focus is on attributes rather than exclusions. The repository includes a file called Common.gitattributes with general rules that could apply to almost any project, as well as more specialized templates for specific languages or project types. Two online generator tools are linked in the README. These let you pick from the templates in this repository and combine them into a single .gitattributes file for your project without manually reading through everything yourself. For teams who want to automate quality checks, the README includes a shell script snippet that scans all files in a repository and reports which ones lack a corresponding .gitattributes rule. A more fully featured version of this check is included as check.sh in the repository itself, with a help flag to see its options. Contributions to the collection are welcome via the standard GitHub fork-and-pull-request process. The main house rule is to keep each commit to a single file change so that merges stay clean. The project is a community-maintained reference rather than a software tool you install.
← gitattributes on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.