One solution (since my old answer isn't a good fit for mergetool
) is to set as a mergetool
a wrapper script.
git config --global merge.tool customMergeTool
git config --global mergetool.customMergeTool.cmd 'customMergeTool.sh \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"'
That wrapper script customMergeTool.sh
would:
- check what
$BASE
is (in particular, its file extension) - call the appropriate merge tool based on that extension
- return the exit status of that
mergetool
Here is for instance the script that the OP elsevers came up with: merge-wrapper
.