有没有办法确定现有的git仓库中的行结束符? [英] Is there a way to determine the line endings in a existing git repo?

查看:123
本文介绍了有没有办法确定现有的git仓库中的行结束符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以确定现有git存储库中的行结束符?



如果我克隆现有的存储库,如何确定使用的是哪个core.autocrlf创作者?

我仍然不确定core.autocrlf的最佳设置,例如在windows box
上(因为存在多种意见:使用代码分发git配置 https://help.github.com/articles/dealing-with-line-endings



奖金问题:您可以通过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仓库中的行结束符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆