Skip to contentSkip to conversation

Choosing a mergetool according to file type

DISCUSSION Gregory Jefferis 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Dear all,

Is there a way to specify which mergetool is called for different files in a repository in the same way that one can specify a diff tool using .gitattributes? I would like to use a custom mergetool for certain binary file types (MS Word dare I say it) but stick with my standard tool (FileMerge.app) for regular files.

I have set up custom mergetool and diff commands in .git/config:

[mergetool "wordmergetool"]
path = /Users/jefferis/bin/
cmd = wordgitmerge "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$LOCAL"
"$PWD/$MERGED"
[diff "wordgitdiff"]
command = wordgitdiff

# adding the following to gitattributes handles the diff case
*.doc diff=wordgitdiff
# but of course this doesn't alter the mergetool that is called.
*.doc mergetool= wordmergetool

Many thanks for any suggestions,

Greg.

git version 1.6.3.2.202.g26c11
MacOS X 10.5.7

Signature · 9 lines
Gregory Jefferis, PhD
Division of Neurobiology
MRC Laboratory of Molecular Biology,
Hills Road,        
Cambridge, CB2 0QH, UK.

http://www2.mrc-lmb.cam.ac.uk/NB/jefferis_g
http://www.neuroscience.cam.ac.uk/directory/profile.php?gsxej2
http://flybrain.stanford.edu