Danimoth/gitattributes

A collection of useful .gitattributes templates

3,855

stars

366

commits

Git Attributes

primary language

Jul 22, 2026

updated

git
gitattributes
gitattributes-templates

README

A Collection of Useful .gitattributes Templates

Similarly to the .gitignore Templates, we're trying to build templates for .gitattributes.

Common.gitattributes contains general exclusions that may apply to any project. Consider including them if they are applicable to your project.

Usage

For more information on gitattributes: gitattributes(5) and for Github-specific grammar: Linguist docs

You can use this handy dandy generator to generate your gitattributes files on the fly based on files inside of this repository.

CI step

To check if all files have a corresponding rule in .gitattributes, this script can be used:

missing_attributes=$(git ls-files | git check-attr -a --stdin | grep 'text: auto' || printf '\n')

if [ -n "$missing_attributes" ]; then
  printf '%s\n%s\n' '.gitattributes rule missing for the following files:' "$missing_attributes"
else
  printf '%s\n' 'All files have a corresponding rule in .gitattributes'
fi

You can also use the checked-in ./check.sh which has more features. Run ./check.sh --help for the available options.

Contributing

Please contribute by forking and sending a pull request.

Also please only modify one file per commit. This'll make merging easier for everyone.

Contributors

(top 30 of 98)

alexkaratarakis

136 commits

Richienb

70 commits

FurkanKambay

19 commits

hyperupcall

7 commits

Danimoth/gitattributes

A collection of useful .gitattributes templates

3,855

stars

366

commits

Git Attributes

primary language

Jul 22, 2026

updated

git
gitattributes
gitattributes-templates

README

A Collection of Useful .gitattributes Templates

Similarly to the .gitignore Templates, we're trying to build templates for .gitattributes.

Common.gitattributes contains general exclusions that may apply to any project. Consider including them if they are applicable to your project.

Usage

For more information on gitattributes: gitattributes(5) and for Github-specific grammar: Linguist docs

You can use this handy dandy generator to generate your gitattributes files on the fly based on files inside of this repository.

CI step

To check if all files have a corresponding rule in .gitattributes, this script can be used:

missing_attributes=$(git ls-files | git check-attr -a --stdin | grep 'text: auto' || printf '\n')

if [ -n "$missing_attributes" ]; then
  printf '%s\n%s\n' '.gitattributes rule missing for the following files:' "$missing_attributes"
else
  printf '%s\n' 'All files have a corresponding rule in .gitattributes'
fi

You can also use the checked-in ./check.sh which has more features. Run ./check.sh --help for the available options.

Contributing

Please contribute by forking and sending a pull request.

Also please only modify one file per commit. This'll make merging easier for everyone.

Contributors

(top 30 of 98)

alexkaratarakis

136 commits

Richienb

70 commits

FurkanKambay

19 commits

hyperupcall

7 commits

Languages

Git Attributes

83.9%

Shell

16.1%