A VSCode/Cursor extension to visualize file changes and commit history between Git branches.
In Cursor 1.7 and earlier versions, there was a built-in feature to compare branches and view all file changes. However, this feature was removed in later versions. This extension was developed to bring back that functionality.
- Branch Comparison: Select two branches and instantly see all file changes
- File Tree View: Display changed files in a directory structure with expand/collapse support
- Commit History: List all commits between the two branches, with a search box to filter by message, author or short hash
- Quick Diff: Click any file to open VSCode's built-in diff view
- Open in Editor: Click the pencil icon on a file to open the working copy directly
- Working Tree Support: When the target branch is the currently checked-out branch, uncommitted changes are included and marked with
· 含未提交 - Auto Refresh: Watches
.gitand the built-in Git extension, so switching branches or editing files updates the panel automatically - Follow Current Branch: When you switch branches, the target branch follows the new current branch — unless you picked the target manually, in which case only the data refreshes
- Active File Highlight: The file open in the editor is highlighted in the tree
- Resizable Layout: Drag the divider to balance the changes list and commit history
- Click the Diff Visualizer icon in the sidebar
- Select the base branch and target branch
- Browse the file changes list and commit history
- Click a file to view detailed differences
The command Diff Visualizer: Compare Branches opens the same view in an editor tab.
- Auto refresh relies on the built-in
vscode.gitextension, so it must be enabled - Switching branches updates the target branch only when it previously pointed at the old current branch; a manually selected target is left untouched
- The panel state (selected branches, expanded folders) is preserved across reloads via webview state
npm install
npm run compile # tsc -> out/
npm run watch # incremental build
npm run package # build .vsix via vscePackage with a version bump when reinstalling over an existing build:
npm version patch --no-git-tag-version
npm run compile
npx @vscode/vsce package
cursor --install-extension ./diff-visualizer-<version>.vsix --forceReload the window after installing for the new build to take effect.
- Target branch now follows the current branch on branch switch, without overriding a manual selection
- Panel refreshes automatically on branch switch, fetch and file save (
.gitwatchers plus the Git extension API) instead of only on open, tab focus or the refresh button - Uncommitted working tree changes are included when comparing against the checked-out branch, and listed as
· 含未提交plus alocalcommit entry - The file currently open in the editor is highlighted in the tree, with its parent folders expanded
git-showdiff documents invalidate on repo change, so reopened diffs no longer show stale content
- Improved commit message formatting
- Open files directly from the diff view
