Git Diff HEAD
A minimal VS Code extension that shows the equivalent of CLI git diff HEAD —
your staged and unstaged edits (tracked files only) — in VS Code's native
multi-file diff editor, with its built-in file-to-file and change-to-change
navigation. A second command reaches further back with git diff HEAD~N.
It relies entirely on the built-in Git extension (vscode.git) and has no
runtime dependencies.
Usage
- Git Diff HEAD: Show Diff (HEAD) — quick mode. Keybinding:
Ctrl+Alt+D
(macOS: Cmd+Alt+D). Compares HEAD against your working tree: your
uncommitted staged + unstaged changes, just like git diff HEAD.
- Git Diff HEAD: Show Diff (HEAD~N…) — prompts for
N and compares
HEAD~N against your working tree (e.g. N=1 is git diff HEAD~), so it
also includes the last N commits along with your uncommitted changes.
Keybinding: Ctrl+Alt+Shift+D (macOS: Cmd+Alt+Shift+D).
Untracked files are not shown, same as the CLI.
Requirements
- VS Code 1.85 or newer (for the multi-file diff editor).
- The built-in Git extension enabled.
Development
Node is only needed to build. This repo compiles with plain tsc:
npm install
npm run compile
Press F5 in VS Code to launch an Extension Development Host and try the command.
Packaging a local .vsix
Build an installable package with vsce:
npx @vscode/vsce package
This compiles and writes git-diff-head-<version>.vsix (the version comes from
package.json). Install it from the Extensions panel → ⋯ → Install from
VSIX…, or from the command line:
code --install-extension git-diff-head-<version>.vsix
License
MIT © Guillermo Marcus.