Archive of

git diff/difftool

set meld as an external diff tool, it is the Old way, which is no longer preferred

First you will need to create a simple wrapper script for meld

$ cat ~/bin/git-meld
#!/usr/bin/bash
exec Meld "$2" "$5"

Please don't forget to add the directory containes Meld.exe to your PATH environment variable.
if you are using a real Linux system instead of MSYS2, you will normally need to change Meld to meld and /usr/bin/bash to /bin/bash

After that, run git config --global diff.external git-meld. Ok, you have done. Every time you run git diff, meld will be called.

In case you want to temporarily disable the behaviour, run git diff --no-ext-diff

Normally it is enough for your daily diff job. However, there is also another approach that you can always keep the default text diff behaviour for git diff while you use git difftool for a gui diff.

Another way / Preferred way

Regarding this approach,

  • don't set the diff.external config, so we will not change the default diff behaviour
  • run the following config instructions:
git config --global diff.tool meld
git config --global difftool.prompt false

If you want a normal text diff, run git diff as usual. If you want a GUI diff, run git difftool instead.
PS. Based on my experience, the second way is more comfortable, so it is the preferred way.