Git 编辑器中缺少换行符(在 Windows 上使用记事本)
Missing line breaks in Git editor (using notepad on Windows)
我一直在尝试将 notepad 设置为 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
但是,当 notepad 启动时,例如对于 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#
而不是(类似于):
# 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#
注意1:这只是配置编辑器中的换行符问题,其他与autocrlf
有关的都可以。
注意 2: 在之前配置编辑器的尝试中(没有完全起作用),编辑器中的换行符是 正常.
我是否缺少 editor
的参数或参数?我的配置有问题吗?
如果你真的想用notepad.exe,看看GitPad。
GitPad 是围绕 notepad.exe 的包装器可执行文件,它采用 git 创建的提交文件并转换 to/from Windows 样式的行结尾。
正如 codeape 所指出的,notepad 不适用于这项工作。
我已经切换到 Notepad++ 并且工作正常。为了让其他有相同或类似问题的人清楚,这就是我的 .gitconfig
文件现在的样子:
[user]
name = Gavin Hope
email = gavin.hope@myemailaddress.com
[core]
autocrlf = true
excludesfile = C:\Users\Gavin.Hope\Documents\gitignore_global.txt
editor = 'C:\Program Files (x86)\Notepad++\notepad++.exe'
[diff]
tool = p4merge
[merge]
tool = p4merge
[mergetool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
keepBackup = false
trustExitCode = false
我一直在尝试将 notepad 设置为 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
但是,当 notepad 启动时,例如对于 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#
而不是(类似于):
# 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#
注意1:这只是配置编辑器中的换行符问题,其他与autocrlf
有关的都可以。
注意 2: 在之前配置编辑器的尝试中(没有完全起作用),编辑器中的换行符是 正常.
我是否缺少 editor
的参数或参数?我的配置有问题吗?
如果你真的想用notepad.exe,看看GitPad。
GitPad 是围绕 notepad.exe 的包装器可执行文件,它采用 git 创建的提交文件并转换 to/from Windows 样式的行结尾。
正如 codeape 所指出的,notepad 不适用于这项工作。
我已经切换到 Notepad++ 并且工作正常。为了让其他有相同或类似问题的人清楚,这就是我的 .gitconfig
文件现在的样子:
[user]
name = Gavin Hope
email = gavin.hope@myemailaddress.com
[core]
autocrlf = true
excludesfile = C:\Users\Gavin.Hope\Documents\gitignore_global.txt
editor = 'C:\Program Files (x86)\Notepad++\notepad++.exe'
[diff]
tool = p4merge
[merge]
tool = p4merge
[mergetool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
keepBackup = false
trustExitCode = false