Git has a file .gitattributes
, that can be used to store attributes for files in this
folder.
* text=auto
*.txt text
*.vcproj text eol=crlf
*.sh text eol=lf
*.jpg -text
*.txt
we only have text
, which can be thought of as text=true
. To unset a value,
you can either use -text
or text=false
.
This file can put in .gitattributes
in the repo root, if you want to share with the team,
or in any folder in git. It can also be placed in $GIT_DIR/info/attributes
if you want it
for current repo, but do not want to share with your team. It can also be stored in
$HOME/.config/git/attributes
and $(prefix)/etc/gitattributes
.
$GIT_DIR/info/attributes
has the highest precedence.
check-attr
git check-attr <name-of-attribute> <name-of-file>
, eg git check-attr diff org/example/MyClass.java
. To check multiple attribuets, or deal with multiple files separate
attributes and files list by --
eg git check-attr foo bar -- file1.txt file2.html
.
linguist-*
.