Quickly compare Git refs and open file diffs in VS Code's native diff editor. Get it on Open VSX — not the VS Code Marketplace — or from GitHub Releases.
- Compare the active file with a Git ref, with current on the left or right
- Compare the active file between two Git refs
- Browse changed files between two refs in a searchable QuickPick
- Open the selected file directly in VS Code's native Git diff tab
All commands are available from the Command Palette under Git Compare Ref:
| Command | Description |
|---|---|
| Compare File with Ref (Current Right) | Opens ref:file on the left and the current file on the right |
| Compare File with Ref (Current Left) | Opens the current file on the left and ref:file on the right |
| Compare File Between Refs | Opens the active file path at the resolved left and right refs |
| Browse Changed Files Between Refs | Lists changed files between two refs and opens the selected diff |
Active-file commands are also available from the editor context menu for file-backed editors.
| Shortcut | Command |
|---|---|
Cmd+Alt+D on macOS, Ctrl+Alt+D elsewhere |
Compare File with Ref (Current Right) |
Cmd+Alt+Shift+D on macOS, Ctrl+Alt+Shift+D elsewhere |
Browse Changed Files Between Refs |
| Setting | Default | Description |
|---|---|---|
gitCompareRefOpen.defaultDiffRange |
threeDot |
Diff range for ref-vs-ref commands. Use threeDot for refA...refB or twoDot for refA..refB. |
threeDot: lists files withrefA...refBand opens left side frommerge-base(refA, refB)and right side fromrefBtwoDot: lists files withrefA..refBand opens left side fromrefAand right side fromrefB
- VS Code or Cursor compatible with VS Code
1.105.0or newer - The built-in Git extension (
vscode.git) - Git available on your
PATH
- Open a file in the editor.
- Run Git Compare Ref: Compare File with Ref (Current Right).
- Pick a branch, tag, or commit.
- VS Code opens the native diff editor for that file.
To review a large branch or pull request:
- Run Git Compare Ref: Browse Changed Files Between Refs.
- Pick base ref and compare ref.
- Search the changed-file list and open the file you want to review.
- Show recent refs at the top of the ref picker
- Filter changed-file browsing by status (
M,A,D,R) - Open the next or previous changed file after viewing one diff
- Compare from SCM and file explorer context menus without needing the active editor
See CHANGELOG.md.
Releasing
This project uses Changesets for version bumps, changelog updates, GitHub releases, and marketplace publishing.
- Create an Open VSX account and personal access token.
- Create the Open VSX namespace that matches
publisherinpackage.json:
pnpm exec ovsx create-namespace <publisher> --pat "$OVSX_PAT"- Optional: create a Visual Studio Marketplace publisher and an Azure DevOps PAT with
Marketplace > Manage. - Add GitHub repository secrets:
OVSX_PATVSCE_PAT(optional, for official VS Code Marketplace)
Before the first publish, make sure publisher in package.json matches your Open VSX namespace and Marketplace publisher ID.
- Make your code changes.
- Add a changeset:
pnpm changeset- Commit the changeset file and push to
master. - Merge the Version Packages pull request created by GitHub Actions.
- The release workflow will then:
- validate the extension in an isolated build job
- publish from a separate job that only installs tooling with
--ignore-scripts - create a GitHub release
- attach the
.vsixto the release - publish to Open VSX when
OVSX_PATis configured - publish to the Visual Studio Marketplace when
VSCE_PATis configured
GitHub Actions follow a default-deny permission model, pin third-party actions to commit SHAs, skip forked pull requests in CI, and split build from publish as recommended in One repo, every workflow. Dependabot opens weekly PRs to bump pinned action SHAs.
Missing publish secrets are skipped. You still get the GitHub release with the VSIX attached.