How to set difftool/mergetool for a specific file extension in Git?
If not already supported, install a shell script that keys off the extension and calls the correct merge tool.
Update: See @Ackdari comments below. The external tool doesn't have to be command-line based. I'm not sure how git uses binary = True
when an external tool is used, but I suspect it might be needed for all flows to work.
If your external diff tool* is command-line only (no GUI), You can use the built-in gitattributes
for this:
in .gitconfig
add:
[diff "my_diff"]
command = Tools/csv_diff
binary = true # Not sure this is required.
and in .gitattributes
(either global or per repository, see here) add:
*.csv diff=my_diff
[*] The command for the external diff tool will be called by git with the 7 parameters detailed under GIT_EXTERNAL_DIFF in the manual here.