Setup .gitconfig for meld use

How to set up .gitconfig for meld

Meld is a diff tool (open source/free) that works very well on ubuntu and MSYS2 windows

To install:

sudo apt install meld

To use:

git diff     # use the standard text based diff
git vdiff    # use the visual diff i.e. the app

Ubuntu

To use it for git, create a ~/.gitconfig file with this content:

[user]
    name = %your_name%
    email = %your_email%

[pull]
    rebase = false
[push]
    autoSetupRemote = true

[diff]
    tool = meld
[difftool]
    prompt = false
[difftool "meld"]
    cmd = meld \"$LOCAL\" \"$REMOTE\"

[merge]
    tool = meld
[mergetool "meld"]
    cmd = meld \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\"

[alias]
    vdiff = !git difftool --dir-diff

Windows/MSYS2

The .gitconfig is the same in windows under MSYS2, except meld has the .exe extension. The rest is the same as above.

# see above

[diff]
    tool = meld
[difftool]
    prompt = false
[difftool "meld"]
    cmd = meld.exe \"$LOCAL\" \"$REMOTE\"

[merge]
    tool = meld
[mergetool "meld"]
    cmd = meld.exe \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\"

[alias]
    vdiff = !git difftool --dir-diff

macOS

The .gitconfig under macOS is similar as well, except meld requires a capital-M. The rest is the same as above.

Note: the current meld version had issues on my version of macOS.

[diff]
    tool = meld
[difftool]
    prompt = false
[difftool "meld"]
    cmd = open -W -a Meld --args \"$LOCAL\" \"$PWD/$REMOTE\"
    trustExitCode = true

[merge]
    tool = meld
[mergetool]
    prompt = false
[mergetool "meld"]
    cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" #--output=\"$PWD/$MERGED\"
    trustExitCode = true

[alias]
    vdiff = !git difftool --dir-diff

- John Arrizza