Compare Local and Remote Branches with external tools

✅ Use VS Code as diff tool (clean setup)

Run this once in your terminal (WSL or normal):

git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"
git config --global difftool.prompt false

🚀 How to use it

git difftool origin/UAT...HEAD

👉 Result:

  • Opens each file in side-by-side diff view
  • Clean UI (like VS Code)

🧠 Tip (very useful)

If you want just one file:

git difftool origin/UAT -- path/to/file.php

✅ Set up WinMerge as diff tool (Windows)

Now let’s wire up WinMerge.


🔧 1. Install WinMerge

Download & install normally (if not already).

Make sure path looks like:

C:\Program Files\WinMerge\WinMergeU.exe
or
C:\WinMerge\WinMergeU.exe

🔧 2. Configure Git

Run this in Windows Git Bash (important, not WSL):

git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd '"/mnt/c/WinMerge/WinMergeU.exe" -e -u -dl Local -dr Remote "$(wslpath -w $LOCAL)" "$(wslpath -w $REMOTE)"'
git config --global difftool.prompt false

🚀 Use it

git difftool origin/UAT...HEAD

👉 Opens:

  • Side-by-side WinMerge UI
  • Directory compare if multiple files

Total page views:

Comments

Popular posts from this blog

Useful aliases

Start all Docker containers

Create rish shortcut on Home Screen