Git编辑器中缺少换行符(在Windows上使用记事本)

Gav*_*ope 1 git git-config

我一直在尝试将记事本设置为Git的默认全局编辑器.

调用记事本现在工作正常.这是我的配置文件的样子:

[user]
    name = Gavin Hope   
    email = gavin.hope@myemailaddress.com

[core]
    autocrlf = true
    excludesfile = C:\\Users\\Gavin.Hope\\Documents\\gitignore_global.txt
    editor = 'C:\\Windows\\notepad.exe'

[diff]
    tool = p4merge

[merge]
    tool = p4merge

[mergetool "p4merge"]
    path = C:/Program Files/Perforce/p4merge.exe
    keepBackup = false
    trustExitCode = false
Run Code Online (Sandbox Code Playgroud)

但是,当记事本启动时,例如git commit,没有换行符.我看到了这个:

# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.## Date:      Wed Oct 28 11:40:40 2015 +0000## On branch playtime# Changes to be committed:#   modified:   file.xyz#
Run Code Online (Sandbox Code Playgroud)

而不是(像这样):

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Wed Oct 28 11:40:40 2015 +0000
#
# On branch playtime
# Changes to be committed:
#   modified:   file.xyz#
Run Code Online (Sandbox Code Playgroud)

注意1:这只是配置编辑器中换行符的问题,其他所有操作都可以autocrlf.

注意2:在之前尝试配置编辑器(没有完全工作)的情况下,编辑器中的换行符是正常的.

我错过了参数或参数editor吗?我的配置有什么问题吗?

cod*_*ape 5

如果你真的想使用notepad.exe,请看看GitPad.

GitPad是一个围绕notepad.exe的包装器可执行文件,它接受git创建的提交文件并转换为Windows样式的行结尾.