When running git mergetool, I'd like to have git select the merge tool used based on the file extension. How can I do this? 
A similar question was asked here: Git: configure patterns for difftool and mergetool
and the answer was to write a custom merge driver. However, it seems like this would be executed upon git merge, whereas I would like the merge tool to be chosen upon git mergetool. 
It seems like there must be some way to specify this with .gitattributes, but I can't seem to figure out how. Any advice?
 
     
    