Git在没有任何参数的情况下启动mergetool

时间:2013-12-17 14:11:40

标签: git git-merge msysgit

在机器A上,git mergetool按预期运行Beyond Compare 3。在机器B上,BC3启动但未在命令行上传递任何参数,从而显示介绍屏幕而不是实际合并。

我将配置从机器A复制到机器B,git config --list与安装路径和push.default=simple完全相同:

merge.tool=bc3
mergetool.bc3='C:/Apps/BeyondCompare3/BCompare.exe'
mergetool.bc3.cmd='C:/Apps/BeyondCompare3/BCompare.exe'
mergetool.bc3.path=C:\Apps\BeyondCompare3\bcomp.exe
push.default=simple

唯一的区别是机器A在Win7 64位下具有git 1.7.11,而机器B(不起作用的机器)在Win8 32位下具有git 1.8.4。

ProcessHacker显示机器A上的命令行(对于完全相同的存储库,位为位)是:

"c:\Program Files (x86)\Beyond Compare 3\bcomp.exe" 
        ./somefile.cs.LOCAL.4192.cs 
        ./somefile.cs.REMOTE.4192.cs
        ./somefile.cs.BASE.4192.cs
        -mergeoutput=somefile.cs /BCompWnd=$00140644

在破碎的机器B上它只是:

c:\Apps\BeyondCompare3\BCompare.exe

我需要哪种神奇的咒语?

1 个答案:

答案 0 :(得分:4)

只是猜测:如果Git已经(在其出厂配置中)了解bc3工具,它将使用mergetool.bc3.path和标准参数。如果没有,它会查找mergetool.bc3.cmd,但是这个需要在命令中指明正确的参数:

mergetool.bc3.cmd="'c:/apps/BeyondCompare3/bcomp.exe' '$LOCAL' '$REMOTE' '$BASE' '$MERGED'"

由于一个不明原因,在机器B上Git不知道bc3的调用,并使用mergetool.bc3.cmd后退,在你的情况下错过了正确的参数。在机器A上,Git知道如何与BC3交谈,并将仅使用mergetool.bc3.path使用该工具的正确调用。

要在机器A和B上分别验证此删除mergetool.bc3.cmdmergetool.bc3.path,行为应与您观察到的完全相同。

要解决此问题,请使用mergetool.bc3.cmd上的完整调用。