我读过Git文档,其中提到可以明确设置某些文件为文本,以便自动更改它们的行结尾或者将其设置为二进制,以确保不受影响。
然而,我也读到Git能够很好地检测二进制文件,这让我认为这并不是必需的。所以我的问题是,我是否真的需要为我的存储库中的每个文件扩展名指定这些显式设置?我看到有一些建议对所有图像文件扩展名都这样做。
然而,我也读到Git能够很好地检测二进制文件,这让我认为这并不是必需的。所以我的问题是,我是否真的需要为我的存储库中的每个文件扩展名指定这些显式设置?我看到有一些建议对所有图像文件扩展名都这样做。
# 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
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
感谢大家的回答,我已经写了一篇博客文章:.gitattributes最佳实践。