如何更改行结束设置 [英] How to change line-ending settings

查看:140
本文介绍了如何更改行结束设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一个文件或菜单可以让我改变设置如何处理行结束符?



有3个选项:


  1. 结帐Windows风格,提交Unix风格

    在检出文本文件时,Git会将LF转换为CRLF。当
    提交文本文件时,CRLF将转换为LF。对于
    的跨平台项目,这是Windows
    (core.autocrlf设置为true)的推荐设置。


  2. p> Checkout按原样提供Unix风格

    在检出文本文件时,Git不会执行任何转换。
    提交文本文件时,CRLF将被转换为LF。对于
    的跨平台项目,这是Unix
    (core.autocrlf设置为input)的推荐设置。

  3. p> 原样签出,按原样提交

    在签出或提交
    文本文件时,Git不会执行任何转换。不推荐跨平台
    项目选择此选项(core.autocrlf设置为false)







$

例如


git config --global core.autocrlf true

有关详情,请向下滚动至这个链接到Pro Git 到名为core.autocrlf的部分






如果你想知道什么 这是保存在,你可以运行命令:
$ b


git config --global --edit


和git全局配置文件应该在文本编辑器中打开,并且您可以看到从哪里加载文件。


Is there a file or menu that will let me change the settings on how to deal with line endings?

There are 3 options:

  1. Checkout Windows-style, commit Unix-style

    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")

  2. Checkout as-is, commit Unix-style

    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").

  3. Checkout as-is, commit as-is

    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")

解决方案

The normal way to control this is with git config

For example

git config --global core.autocrlf true

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

and the git global config file should open in a text editor, and you can see where that file was loaded from.

这篇关于如何更改行结束设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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