651.288.7000 info@intertech.com

Source merging is inevitable with concurrent development. To help with merges, source control products have a merge tool. Some, including Git, allow configuring your favorite merge tool vs forcing use of their own merge tool.

Built-In Merge Tool Configuration

Git supports the easy configuration of many merge tools. The Git help lists them, and as of this writing they are:

  • araxis
  • bc3
  • codecompare
  • deltawalker
  • diffuse
  • ecmerge
  • emerge
  • gvimdiff
  • gvimdiff2
  • kdiff3
  • meld
  • opendiff
  • p4merge
  • tkdiff
  • tortoisemerge
  • vimdiff
  • vimdiff2
  • xxdiff

To configure the git merge tool, use:

 Example

One of my favorite merge tools is by Perforce: P4Merge. It’s free to use, and does not require using the Perforce server or a license, so anyone can use it.

As an example, to configure it globally for all Git repos, execute:

Other Merge Tools

When specifying a merge.tool value not in the supported list, also specify a mergetool.<tool>.cmd matching variable. The value of this variable is the command to invoke the merge tool (may specify a script for ease).

In the process spawned to run the specified merge command, Git creates BASE, LOCAL, REMOTE, and MERGED environment variables. Use these variables in the launch of the merge tool.

Example

Diff Tool Different from Merge Tool

To configure the diff tool Git uses different from the merge tool, similarly configure with the diff.tool setting:

Further Info

Git has additional mergetool config variables.  Consult the Git help for config to see them:

 

Like What You've Read?

Subscribe to the Blog.

Every Friday we send that week's content from our Developers via email. Try it out!

Some ad blockers can block the form below.

You have Successfully Subscribed!

Pin It on Pinterest

Share This