Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>Branch DiffyNew to Visual Studio Code? Get it now.
Branch Diffy

Branch Diffy

Jeppe Vinberg

|
2 installs
| (0) | Free
Review PR-style Git changes from the merge base with a changed-files sidebar, native gutter markers, and separate unstaged changes.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Branch Diffy

A VS Code sidebar for PR review: see your checked-out branch's changes since its merge base with another branch, defaulting to main.

Requirements

  • VS Code 1.95 or newer with its built-in Git extension enabled.
  • Git available to VS Code and a trusted workspace containing a Git repository.

Supports local folders and remote extension hosts (WSL, SSH, and Dev Containers), but not virtual workspaces or VS Code for the Web. Node.js is only needed for development, not to use the extension.

Use

  1. Open a Git repository and select Branch Diffy in the left Activity Bar.
  2. Use the Select Comparison Branch (branch) button to choose a local or remote-tracking branch.
  3. The view has collapsible Committed changes and Unstaged changes sections. Files show native, theme-aware Git-style badges: A added, M modified, D deleted, R renamed, C copied, T type changed, U untracked, or ! conflicted. The unstaged section is hidden when empty.
  4. Click a file to open it. Committed deletions open a read-only version from the merge base; unstaged deletions open the index (staged) version. Committed files missing from your working directory open the committed version instead; unexpectedly missing working files report an error.
  5. Hover a file and select Open Diff. In Committed changes, this compares the merge-base version with the committed HEAD version. In Unstaged changes, it compares the index (including staged edits) against the live working file, including unsaved editor contents. New/untracked files have an empty left side; deleted files have an empty right side.

The view refreshes when Git reports repository changes, when it becomes visible, or when you select Refresh. Workspaces with multiple repositories also get a Select Repository button. The selected comparison branch is remembered separately for each repository in the workspace.

Folder hierarchy

Use View as Tree in the Changed Files toolbar to group files into collapsible folders in both sections. Use View as List to return to the flat list with folder paths beside filenames. The flat list is the default; your choice is remembered for the workspace and applies to whichever repository you select. Filters, file counts, and file/diff actions work in either layout.

Folders use Explorer's native expand/collapse arrows and inherit theme-aware colors and change indicators from their visible descendants. As in Explorer, deletions do not highlight parent folders. Each section is decorated independently, and Explorer's decoration color/badge settings apply.

File filters

Type glob patterns directly into the files to include and files to exclude text fields at the top of the Branch Diffy sidebar, like VS Code Search. The changed-file list updates as you type:

  • *.md excludes (or includes) Markdown files at any depth.
  • *.ts, *.tsx matches either extension; *.{ts,tsx} also works.
  • docs or docs/** matches a folder and its descendants at any depth.
  • ./src/** matches only the selected repository's root src folder.
  • *, **, ?, and character ranges such as [a-z] are supported. Patterns are case-sensitive; use / or \ as path separators.

An empty include filter includes everything; exclusions always win. Both sections and their counts are filtered using the displayed file path (the new path for renames), including deleted files. Empty a text field to clear that filter, or use Clear File Filters in the File Filters header to reset both. Invalid patterns show an inline error and leave the last valid filter applied. The Files to Include… and Files to Exclude… commands focus the corresponding field.

Filters are remembered for the workspace and apply to whichever repository you select. They only affect this view, not editor markers, Explorer decorations, Git ignore rules, or VS Code's Search settings.

While a filter is active, section counts show the visible and total files, for example Committed changes (showing 5/11). Clearing both filters restores the normal count.

By default, File Filters uses the minimum pane height and Changed Files takes the remaining space. You can drag the divider to resize them. VS Code remembers pane sizes, so these defaults do not override an existing workspace's saved layout.

Native editor markers

Branch Diffy starts automatically after VS Code finishes starting, without needing to open its sidebar, and enables native, theme-aware gutter markers for the selected repository: green for added lines, blue for modified lines, and red for deleted lines. Click a marker to see VS Code's inline change preview. Renamed files compare against their original path at the merge base.

Branch markers show changes from the merge base to the index, mapped into the live editor. Unstaged and unsaved edits are incorporated into a synthetic, read-only merge-base baseline so the built-in Git provider can mark those edits normally. For example, a committed modification followed by an unstaged added line keeps a blue branch marker on the modification and Git's green marker on the addition. Local edits take precedence on overlapping lines; an independent branch edit sharing a local deletion's gutter anchor remains accessible through the inline preview's comparison dropdown. Staged changes remain part of the branch comparison. This does not modify files, commits, or the index.

The branch marker's inline preview uses this adjusted baseline, not necessarily the exact merge-base contents. The Committed changes section and its Open Diff action remain committed-only and unadjusted; the separate Unstaged changes section shows local changes relative to the index. Entirely deleted files are still viewed through the sidebar or Open Diff, since they have no working-copy editor to mark. Very large or expensive text comparisons yield to native Git markers for that file; binary baselines remain byte-preserving.

The status bar shows Branch Diffy: On with an open eye or Branch Diffy: Off with a crossed-out eye. Click it to toggle markers, even when the Branch Diffy sidebar is closed. The view-title button uses the same eye icons; hover either control to see the current state and what clicking will do. The Command Palette likewise shows Branch Diffy: Disable Branch Markers (Currently On) or Branch Diffy: Enable Branch Markers (Currently Off). Markers are on by default; the toggle is remembered for this workspace. Switching branches or repositories updates the baseline automatically. The branchDiffy.toggleMarkers command remains available for custom keybindings.

While branch markers are enabled, files in the selected repository's Committed changes section also show Git-style status letters (such as M for modified) and theme-aware status colors in Explorer. These decorations propagate to parent folders using VS Code's native Git-style folder highlighting and change indicators, except for deletions, which do not decorate parent folders. Turning markers off removes the branch colors, badges, and folder indicators without changing the sidebar's status badges or native Git decorations. Local-only changes and files belonging to nested repositories are not branch-decorated.

Native integration adds a separate Branch Diffy (branch-name) provider in Source Control, with its commit input hidden. It does not replace the built-in Git provider, change Git settings, or inflate the Source Control change count. If a change preview offers multiple baselines, choose Branch Diffy (branch-name) for the branch comparison. Markers follow VS Code's scm.diffDecorations setting; use all or gutter to show them beside line numbers. VS Code may suppress gutter marks for entirely new untracked files with empty baselines.

What is compared?

The Committed changes section compares the merge base (common ancestor) of the selected comparison branch and HEAD to HEAD, equivalent to git diff <comparison-branch>...HEAD. Like a pull request, it shows only your branch's changes since that common ancestor; changes made only on the comparison branch do not appear. For example, if main advances after you branch off, those new main changes are excluded. Uncommitted and staged changes to tracked files are not included in that section or its Open Diff action. Clicking an existing file opens your working copy, which can include local edits.

The Unstaged changes section works like Source Control's Changes list: saved modifications and deletions of tracked files, untracked files, and further edits to files that already have staged changes. Staged-only changes are excluded. Staging all changes to a file removes it from this section; editing it again brings it back. The list reflects saved on-disk changes, but an open diff also follows unsaved editor contents. Unresolved conflicts are shown with ! and use the merge's “ours” version as their diff baseline.

Untracked files respect .gitignore, repository-local excludes, and global Git ignore rules. The unstaged section excludes files belonging to nested repositories and is independent of the marker toggle. A file can appear in both sections with different comparisons; these are distinct entries. The view badge counts entries across both sections. No staging, unstaging, or discard actions are provided: the extension keeps Git operations read-only.

Remote branches use already-fetched local references; the extension never fetches, checks out branches, or changes your repository. If main does not exist, use the branch picker. If no merge base is available (unrelated histories or a shallow clone missing the common ancestor), the view reports an error instead of comparing branch tips. Detached HEAD, binary files, filenames containing spaces, and Git worktrees are supported.

Settings

{
  "branchDiffy.defaultBaseBranch": "main"
}

This controls the initial branch for repositories without a remembered selection. Use the branch picker to change an existing selection.

Known limitations

On VS Code 1.95.3, the native diff engine displays committed new files with blue modified gutter markers instead of green added markers. Their sidebar and Explorer status remains A, and their committed diff correctly has an empty baseline. This is a native quick-diff limitation; the extension does not replace VS Code's marker renderer.

Develop

Requires Node.js 22+ and Git in addition to the requirements above.

npm ci
npm run check
npm test

Open this folder in VS Code and press F5 to start an Extension Development Host, then open a Git repository there.

npm run test:vscode also runs a smoke test in an isolated VS Code window. It downloads VS Code 1.95.3 by default; set VSCODE_EXECUTABLE_PATH to use an existing VS Code executable instead. Unit/integration tests in npm test use real temporary Git repositories and a mocked VS Code UI.

Set BRANCH_DIFFY_TEST_FILTERS_ONLY=1 when running the smoke test to check only the filter inputs, folder/list toggle, and default pane sizing, independently of native editor-marker tests.

On Windows PowerShell, use npm.cmd instead of npm if script execution is restricted. VS Code API types are pinned to 1.95.0 to catch accidental use of newer APIs; keep the real-editor smoke test as the runtime compatibility check.

Install locally

npm run package
code --install-extension branch-diffy-0.2.0.vsix

Alternatively use Extensions: Install from VSIX… in VS Code. Packaging does not publish the extension.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft