问题描述
有没有一种方法可以确定现有git存储库中的行结束符?如果我克隆现有的存储库,如何确定使用的是哪个core.autocrlf创作者?
我仍然不确定core.autocrlf的最佳设置,例如在windows box
上(因为存在多种意见:或)
奖金问题:您可以通过Windows(使用标准工具)确定回购站是否在所有提交中混合了行结尾(通过错误的core.autocrlf设置)?为了检查存储库中实际提交了哪些行结束符(不管你的 core.autocrlf
设置),请尝试以下操作:
git grep -I --files-with-matches --perl- regexp'\r'HEAD
( -I
的意思不应该查看二进制文件。)
Is there a way to determine the line endings in a existing git repository?
If I clone a existing repository how do I determine what core.autocrlf was used by the creator?
I'm still uncertain whats the best setting for core.autocrlf e.g on a windows box(since there are multiple opinions: Distributing git configuration with the code or https://help.github.com/articles/dealing-with-line-endings)
Bonus question: Can you determine on windows (with standard tools) if a repo has mixed line endings (by wrong core.autocrlf setting) through all commits?
To check what line endings were actually committed in the repository (regardless of your core.autocrlf
setting), try the following:
git grep -I --files-with-matches --perl-regexp '\r' HEAD
(-I
means that binary files should not be looked at.)
这篇关于有没有办法确定现有的git仓库中的行结束符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!