Git difftool with Visual Studio Code

Many developers already use Visual Studio Code, which is a small and distinct program from Visual Studio available for Linux, MacOS and Windows. VS Code can do Git 3-way merge.

VS Code for Git difftool and mergetool:

git config --global diff.tool vscode
git config --global merge.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff \$LOCAL \$REMOTE"
git config --global mergetool.vscode.cmd "code --wait --merge \$REMOTE \$LOCAL \$BASE \$MERGED"

Note the backslashes so that the shell doesn’t gobble the “$” variables before they’re saved to ~/.gitconfig.


Alternative: Meld