Skip to content

Instantly share code, notes, and snippets.

@amiryal
Last active February 20, 2024 21:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amiryal/1159852 to your computer and use it in GitHub Desktop.
Save amiryal/1159852 to your computer and use it in GitHub Desktop.
Easily visualise Git merge.conflictstyle diff3 with meld, while preserving all information
[merge]
conflictstyle = diff3
tool = three_meld
[mergetool "three_meld"]
# Opens up four diff windows:
# LOCAL:MERGED, BASE:LOCAL, BASE:REMOTE, LOCAL:REMOTE
#
# Lets you edit the MERGED file (including original diff3 markers), showing
# you the final diff from LOCAL. For reference, you can look in the other
# windows to see how LOCAL and REMOTE are each different from BASE, as well
# as the dumb diff between LOCAL and REMOTE.
cmd = "env LOCAL=\"$LOCAL\" REMOTE=\"$REMOTE\" BASE=\"$BASE\" MERGED=\"$MERGED\" bash -c 'meld --diff \"$LOCAL\" \"$MERGED\" \"$REMOTE\" --diff \"$BASE\" \"$LOCAL\" --diff \"$BASE\" \"$REMOTE\"'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment