【发布时间】:2020-12-17 02:35:51
【问题描述】:
我使用 Beyond Compare 作为我的外部差异工具。当我在 .gitconfig 中的新计算机上配置它时,它不起作用,就像我在其他计算机上所做的那样。如果我用太多引号指定 extcmd,那么它确实有效。
现在和以前的一大区别是我在我的新存储库上使用 LFS。
.gitconfig 文件:
[diff]
tool = bc4
renameLimit = 999999
[difftool]
prompt = false
[difftool "bc4"]
cmd = 'C:/Program Files/Beyond Compare 4/BComp.exe' \"$LOCAL\" \"$REMOTE\"
不起作用(使用单引号或双引号):
$ git difftool --extcmd='C:/Program Files/Beyond Compare 4/BComp.exe' HEAD
C:/Program Files/Git/mingw64/libexec/git-core\git-difftool--helper: line 62: C:/Program: No such file or directory
fatal: external diff died, stopping at file.cs
有效:
git difftool --extcmd="'C:/Program Files/Beyond Compare 4/BComp.exe'" HEAD
-
我怎样才能让它工作,以便我可以使用
git difftool HEAD? -
是 Git LFS 导致我的问题吗?
-
我的新计算机上是否有其他错误配置导致了我的问题?
我尝试将配置中的单引号 (') 更改为双引号 ("),但这也不起作用。
我在全新安装的 Windows 10 上使用 git 版本 2.29.2.windows.2。
编辑:忘记明确“不起作用”是什么意思: 它不会打开 Beyond Compare,但没有错误消息。几秒钟内它似乎什么也没做:
$ git difftool HEAD
$
我的整个 .gitconfig(以防万一):https://hastebin.com/icuduxecen.ini
【问题讨论】:
-
你试过“C:\\Program Files\\Beyond Compare 4\\BComp.exe”吗?注意双引号而不是单引号和双\(转义)
-
这样做会得到:
$ git difftool --extcmd="C:\\Program Files\\Beyond Compare 4\\BComp.exe" HEAD C:/Program Files/Git/mingw64/libexec/git-core\git-difftool--helper: line 62: C:Program: command not found fatal: external diff died, stopping at file.cs -
将其放入配置中与原始设置的结果相同:几秒钟内什么也不做。
标签: git beyondcompare difftool