在运行git mergetool时,我希望让git根据文件扩展名选择使用的合并工具。我该怎么做?
这里提出了一个类似的问题:Git: configure patterns for difftool and mergetool,答案是编写一个自定义的合并驱动程序。然而,这似乎是在git merge上执行的,而我希望在git mergetool上选择合并工具。
使用.gitattributes似乎必须有某种方法来指定这一点,但我似乎不知道如何做到这一点。有什么建议吗?
发布于 2014-04-27 08:32:35
一种解决方案(因为我的old answer不适合mergetool)是将包装脚本设置为mergetool。
git config --global merge.tool customMergeTool
git config --global mergetool.customMergeTool.cmd 'customMergeTool.sh \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"'包装器脚本customMergeTool.sh将:
$BASE是什么(特别是它的文件扩展名)mergetool的退出状态例如,下面是OP elsevers提供的脚本:merge-wrapper。
https://stackoverflow.com/questions/23313620
复制相似问题