![](/img/trans.png)
[英]Make git store text files with CRLF line endings with .gitattributes
[英]how do I make the default git commit message use CRLF line endings
默认的git commit消息包括以下内容:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch testNotepad
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: foo.txt
我把记事本设置为我在git中的默认编辑器。 由于行结尾不是CRLF,因此该消息显示为单行。 我想改变这个。 如何才能做到这一点?
git不直接支持这个。 您将需要使用可以处理Unix样式行结尾的编辑器( \\n
)。
但是,如果您选择的编辑器不支持此功能,您可以将编辑器设置为代理,将行结尾转换为Windows样式( \\r\\n
),调用编辑器,然后将行结尾转换为Unix- git的样式( \\n
)。
GitPad是可以实现此目的的编辑器代理的最佳示例。
自提出此问题以来,可能已添加了支持记事本的此功能。 我能够使用版本2.16.1.windows.4进行重新编程。
打开记事本,没有显示的行返回:
git config --global core.editor "notepad.exe"
但是使用它对我有用:
git config --global core.editor "notepad"
只是将.exe放在最后。
您是否尝试将core.autocrlf
设置为true
?
就像是:
git config --global core.autocrlf true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.