How to configure a visual diff or merge tool in git on Windows
2016-10-15
Resolving merge conflicts can get confusing very fast, a nice GUI tool to facilitate this job is meld. It supports three-way file comparison to see the two different code versions and the currently merged file in the middle.
Image source http://meldmerge.org/features.html
To resolve the merge conflict with meld using the git-mergetool like this
git mergetool -y <filename>
Only a small change to the ~/.gitconfig
file is needed.
On Windows, open %userprofile%\.gitconfig
and then configure meld as diff and merge tool like this:
[diff]
tool = meld
[difftool "meld"]
cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\" $LOCAL $REMOTE
[merge]
tool = meld
[mergetool "meld"]
cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\" $PWD/$LOCAL $PWD/$BASE $PWD/$REMOTE --output=$PWD/$MERGED
For a little more information on the variables used, look at this stackoverlow comment.