els*_*ers 7 git merge git-config gitattributes
在运行时git mergetool,我想让git选择基于文件扩展名使用的合并工具.我怎样才能做到这一点?
这里也提出了类似的问题:Git:为difftool和mergetool配置模式,
答案是编写自定义合并驱动程序.但是,似乎这将被执行git merge,而我希望选择合并工具git mergetool.
似乎必须有一些方法来指定.gitattributes,但我似乎无法弄清楚如何.有什么建议?
一种解决方案(因为我老的答案是不适合的mergetool)是设置为mergetool一个包装脚本.
git config --global merge.tool customMergeTool
git config --global mergetool.customMergeTool.cmd 'customMergeTool.sh \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"'
Run Code Online (Sandbox Code Playgroud)
该包装脚本customMergeTool.sh将:
$BASE(特别是其文件扩展名)mergetool以下是OPOvenvers提出的脚本:merge-wrapper.