Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Diff BranchNew to Visual Studio Code? Get it now.
Diff Branch

Diff Branch

Oddiss

|
1 install
| (0) | Free
Review changes across your Git branch, including committed work, with a changed-files view and editor markers.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Diff Branch

CI License: MIT

Diff Branch shows everything changed on the current Git branch, including committed work that VS Code's standard working-tree view no longer shows. It compares against the commit where the branch split from its base and presents the results in a dedicated Activity Bar view, alongside distinctive editor markers and the standard diff UI.

Features

  • Automatically chooses a comparison base, with support for stacked branches and manual overrides.
  • Shows committed, staged, unstaged, and untracked changes in a dedicated Diff Branch view.
  • Shows Git-detected renames as a single old → new entry, with diffs against the original file and markers for actual edits.
  • Switches between committed-only, committed-plus-staged, and complete diff scopes.
  • Switches between flat and folder-tree layouts, with per-file line counts and folder/repository totals.
  • Maps branch patterns such as feature/* to configured base branches.
  • Adds customizable branch-change colors distinct from normal working-tree decorations.
  • Refreshes automatically after saves and branch checkouts.

Installation

In VS Code, open Extensions, search for Diff Branch, and select the extension published by Oddiss. You can also open its Marketplace listing.

To install a downloaded .vsix instead, open Extensions → ⋯ → Install from VSIX… and select the file. Release packages are available from GitHub Releases.

Diff Branch requires VS Code 1.95 or later and Git available on your system path.

Usage

Open a Git repository and select Diff Branch in the Activity Bar. The extension starts enabled and chooses a comparison base automatically. Select a changed file to open its diff.

Use the title-bar icons to choose a comparison branch, choose a diff scope, switch layouts, or refresh. Click the Base row or run Diff Branch: Choose Comparison Branch to select a different base. Choose Automatic to return to automatic base selection.

Click the Scope row or the filter icon to choose what the comparison includes:

  • Committed only — commits made after the branch split.
  • Committed + staged — committed changes plus the current Git index.
  • Everything — committed, staged, unstaged, and untracked changes.

The choice is saved per workspace in branchDiff.scope.

Choosing the current branch (or HEAD) compares against its latest commit. Committed only is empty, Committed + staged shows staged changes, and Everything shows staged, unstaged, and untracked changes.

Use Diff Branch: Toggle Flat / Folder Tree or the tree icon in the view title to switch layouts. The choice is saved in branchDiff.viewLayout (default: flat). File rows show added/deleted line counts; folder rows and the view heading show totals for the visible comparison after exclusions. Binary files are counted separately, and unreadable untracked files show statistics as unavailable.

Exclude generated or noisy files with glob patterns. Patterns without a slash match a filename at any depth; a leading slash anchors the match to the repository root:

"branchDiff.exclude": [
  "**/*.snap",
  "dist/**",
  "package-lock.json"
]

Other commands:

  • Diff Branch: Refresh
  • Diff Branch: Choose Diff Scope
  • Diff Branch: Toggle Decorations
  • Diff Branch: Use Automatic Base

Changed files appear only under Branch Changes in the dedicated Diff Branch view, keeping them separate from uncommitted changes in Source Control. The view uses its own accent colors and status icons; hover over a file for its full path and branch status. Selecting a file opens the full comparison.

When there are no files to show, the view explains whether the comparison is empty, Diff Branch is disabled, no repository was found, or the comparison failed. Use the actions in the view to choose a base or scope, enable Diff Branch, open a repository folder, or retry. Hover over a failed comparison message for the error details. In multi-repository workspaces, each repository shows its own state and recovery actions.

How automatic base detection works

The Base row shows the selected ref and the short merge-base commit ID. Hover over it to see why that base was chosen and the full comparison commit. Click it to choose another base. The explanation distinguishes explicit settings, matching branch mappings, nearest ancestors, and default/previous-commit fallbacks. It is available in both layouts, including empty comparisons.

By default, Diff Branch finds the closest local branch whose tip is an ancestor of the current branch. Given main → A → B → C, this selects B from C, A from B, and main from A.

Git does not store explicit parent-branch metadata. This graph-based approach works naturally for branch stacks while their parent branch tips remain in the current branch's history. If no suitable local ancestor exists, Diff Branch falls back to:

  1. The remote default branch (origin/HEAD).
  2. main, master, develop, or development.
  3. The previous commit for a single-branch repository.

The comparison commit is the merge-base of that ref and HEAD.

  • Set branchDiff.automaticBaseStrategy to defaultBranch to always use the repository default instead.
  • Set branchDiff.baseBranch to a branch name to override automatic detection completely.

You can also map branch names or wildcard patterns to their bases in User Settings. Exact branch names take priority over patterns:

"branchDiff.branchBases": {
  "feature/*": "develop",
  "release/*": "main",
  "feature/special": "release"
}

Branch marker colors

Markers are aligned to the current editor text, including unsaved edits. In committed/staged scopes, later edits can move a marker but do not become scoped changes themselves. Markers for lines that have since been replaced or deleted are hidden. While typing, markers are cleared and recalculated after a short pause.

Diff Branch adds compact colored glyph-margin and overview-ruler markers instead of reusing VS Code's normal working-tree colors. The markers stay outside the code area so they do not compete with indentation or text. Customize them in User Settings:

"branchDiff.colors": {
  "added": "#C586C0",
  "modified": "#D7BA7D",
  "deleted": "#F48771"
}

Notes

  • Rename detection follows Git's similarity matching for tracked files. Stage a moved file to let Git detect its rename; an untracked destination remains separate. Exclusions match the destination path of a rename.

  • Nested repositories must be opened as workspace folders to be discovered.

Contributing and support

Use GitHub Issues for bugs and feature requests. For security issues, follow the security policy.

For development setup and pull requests, see the contribution guide and code of conduct.

Diff Branch is available under the MIT License.

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