.gitattributes 配置


.gitattributes 文件放在 git 项目根目录下,用来配置该项目的 git 属性。


配置示例 1

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

来源和解释见 Configuring Git to handle line endings

配置示例 2

*.java text eol=lf
*.gradle text eol=lf
*.md text eol=lf

( 本文完 )