2012-05-16 09:08:39 -04:00
# A Collection of Useful .gitattributes Templates
2020-11-08 16:26:29 -05:00
Similarly to the [`.gitignore` Templates][gt], we're trying to build
templates for `.gitattributes` .
2012-05-16 09:10:50 -04:00
2014-04-13 17:02:31 -04:00
`Common.gitattributes` contains general exclusions that may apply to any project.
2014-04-13 06:41:37 -04:00
Consider including them if they are applicable to your project.
2019-04-18 22:32:05 -04:00
You can use [this handy dandy generator ](https://richienb.github.io/gitattributes-generator ) to generate your gitattributes files on the fly based on files inside of this repository.
2021-10-09 20:22:01 -04:00
## CI step
To check if all files have a corresponding rule in .gitattributes, this script can be used:
```sh
2023-08-17 07:06:00 -04:00
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"
2021-10-09 20:22:01 -04:00
else
2023-08-17 07:06:00 -04:00
printf '%s\n' 'All files have a corresponding rule in .gitattributes'
2021-10-09 20:22:01 -04:00
fi
```
2023-08-24 23:52:08 -04:00
You can also use the checked-in `./check.sh` which has more features.
Run `./check.sh --help` for the available options.
2021-10-09 20:22:01 -04:00
## Contributing
2012-05-16 09:10:50 -04:00
Please contribute by [forking][fk] and sending a [pull request][pr].
2012-05-16 09:08:39 -04:00
Also **please** only modify **one file** per commit. This'll
make merging easier for everyone.
2019-07-11 01:52:56 -04:00
For more information on gitattributes: [gitattributes(5)][g5] and for Github-specific grammar: [Linguist docs][gh]
2012-05-16 09:08:39 -04:00
2012-05-16 09:09:40 -04:00
[gt]: https://github.com/github/gitignore
2012-05-16 09:08:39 -04:00
[fk]: http://help.github.com/forking/
[pr]: http://help.github.com/pull-requests/
2021-04-29 18:23:12 -04:00
[g5]: https://www.git-scm.com/docs/gitattributes
2019-07-08 08:33:17 -04:00
[gh]: https://www.rubydoc.info/github/github/linguist