Compare local files with remote Git repo using WinMerge

Here’s a clean step-by-step way to compare your local WSL repo folder vs the remote repo state in WinMerge, and then show only changed files.

1) In WSL: go to your repo and fetch remote

cd /path/to/your/repo git fetch origin

2) In WSL: create a “remote snapshot” folder (safe, no checkout)

This exports the remote branch into a temp folder.

REMOTE_BRANCH=origin/main SNAP=/tmp/repo_remote_snapshot rm -rf "$SNAP" mkdir -p "$SNAP" git archive "$REMOTE_BRANCH" | tar -x -C "$SNAP"
  • Change origin/main if your remote branch is different (e.g. origin/master, origin/develop).

3) Open WinMerge and start a folder compare

  1. Launch WinMerge (on Windows)

  2. File → Open… (or “Open”)

  3. Select Folder Compare

4) Pick the two folders (WSL paths via \\wsl$)

In WinMerge:

Left (Local working folder)

Use your actual repo path in WSL:

\\wsl$\Ubuntu\home\<youruser>\path\to\your\repo

Right (Remote snapshot folder)

\\wsl$\Ubuntu\tmp\repo_remote_snapshot

Replace Ubuntu with your distro name (e.g. Debian, Ubuntu-22.04).

5) Make WinMerge show only changed files

In WinMerge:

  • View → Show Different Items (wording may be “Different” / “Different Files Only”)

Now you’ll see only:

  • modified files

  • added files (exist one side)

  • deleted files (missing one side)

6) Compare files quickly

  • Double-click any file → it opens the diff view

  • Use Next Difference to move through changes


Common useful tweaks (optional)

Ignore line endings / whitespace noise

  • Edit → Options → Compare

    • enable ignoring EOL differences (CRLF vs LF)

    • optionally ignore whitespace

Exclude folders like .git, node_modules, dist

  • Edit → Options → Compare → Folder

    • add filters/excludes (WinMerge has “File filters”)


Quick “copy/paste” version (only 2 commands)

cd /path/to/your/repo && git fetch origin rm -rf /tmp/repo_remote_snapshot && mkdir -p /tmp/repo_remote_snapshot && git archive origin/main | tar -x -C /tmp/repo_remote_snapshot

Then compare:

  • \\wsl$\Ubuntu\home\<youruser>\path\to\repo

  • \\wsl$\Ubuntu\tmp\repo_remote_snapshot


Total page views:

Comments

Popular posts from this blog

Useful aliases

Start all Docker containers