如何更改行尾设置 [英] How to change line-ending settings
问题描述
是否有文件或菜单可以让我更改有关如何处理行尾的设置?
Is there a file or menu that will let me change the settings on how to deal with line endings?
我读到有 3 个选项:
I read there are 3 options:
检查 Windows 风格,提交 Unix 风格
Git 会在检出文本文件时将 LF 转换为 CRLF.什么时候提交文本文件,CRLF 将被转换为 LF.为了跨平台项目,这是 Windows 上的推荐设置(core.autocrlf"设置为true")
Git will convert LF to CRLF when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Windows ("core.autocrlf" is set to "true")
按原样签出,提交 Unix 风格
Git 在检出文本文件时不会执行任何转换.提交文本文件时,CRLF 将转换为 LF.为了跨平台项目这是 Unix 上的推荐设置(core.autocrlf"设置为输入").
Git will not perform any conversion when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects this is the recommended setting on Unix ("core.autocrlf" is set to "input").
按原样签出,按原样提交
Git 在检出或提交时不会执行任何转换文本文件.不建议跨平台选择此选项项目(core.autocrlf"设置为false")
Git will not perform any conversions when checking out or committing text files. Choosing this option is not recommended for cross-platform projects ("core.autocrlf" is set to "false")
推荐答案
控制它的正常方法是使用 git config
The normal way to control this is with git config
例如
git config --global core.autocrlf true
有关详细信息,请向下滚动此 Pro Git 链接 到名为core.autocrlf"的部分
For details, scroll down in this link to Pro Git to the section named "core.autocrlf"
如果你想知道这是保存在什么文件中,你可以运行以下命令:
If you want to know what file this is saved in, you can run the command:
git config --global --edit
并且 git 全局配置文件应该在文本编辑器中打开,您可以看到该文件是从哪里加载的.
and the git global config file should open in a text editor, and you can see where that file was loaded from.
这篇关于如何更改行尾设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!