Skip to content

Instantly share code, notes, and snippets.

@gkhays
Last active April 11, 2020 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkhays/2a3634681485e547c234be427a711b65 to your computer and use it in GitHub Desktop.
Save gkhays/2a3634681485e547c234be427a711b65 to your computer and use it in GitHub Desktop.
Git external merge and diff tools

External Merge and Diff Tools

Run four config commands

$ git config --global merge.tool extMerge
$ git config --global mergetool.extMerge.cmd \
  'extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"'
$ git config --global mergetool.extMerge.trustExitCode false
$ git config --global diff.external extDiff

Or edit ~/.gitconfig

[merge]
  tool = extMerge
[mergetool "extMerge"]
  cmd = extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
  trustExitCode = false
[diff]
  external = extDiff

Then a diff

$ git diff 32d1776b1^ 32d1776b1

Will launch the newly configured visual merge tool.

References

  1. External Merge and Diff Tools
  2. Pro Git book online
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment