Branch Explainer
A VS Code / Cursor extension that helps you understand your own branch before you open a pull request.
- See your changes. Lines your branch added (compared with the main branch) are highlighted green; a red line marks where code was removed. Committed and uncommitted changes both count.
- Get each change explained. Hover a changed line, or click 💡 Explain above it, for a short explanation in simple words, written by your own Claude Code.
- Know every file. The panel tells you what each changed file is for and why it exists.
- Track your understanding. Mark each change as understood and fill the meter to 100%.
- See UI changes (optional). For files you map to pages, the panel shows a screenshot of the page from your local site, with the changed element outlined. Click it to open it full size.
Requirements
- VS Code 1.80+ or Cursor.
- Claude Code installed and signed in. Check with
claude --version in a terminal.
- Google Chrome or Chromium, only for UI previews.
Install
Search for Branch Explainer in the Extensions view of VS Code and install it.
To run it from source instead, build it with npx @vscode/vsce package, then use Extensions → ⋯ → Install from VSIX… and run Developer: Reload Window.
Use it
- Open a git repository and check out your branch.
- The status bar shows the branch, how many files changed,
+added −removed lines and your 🧠 %. Click it, or the 💡 icon in the activity bar, to open the My Branch panel.
- If everything on the branch is already committed, the panel opens on a start card: press ▶ Explain this branch, or 🔀 Switch branch to pick another one. Uncommitted files are marked ✏️ and listed first.
- Press 🎯 Next change. The file opens at the change, and the panel shows About this file, a mini diff and the explanation.
- Press ✅ Mark as understood, then 🎯 Next change or ⏭ Next file.
- Come back after more work (review fixes, a new commit): the panel opens on 🆕 New since last explained. A file you had explained in full shows only what changed in it since then, and a file that has not changed since is left out. Press 📚 Whole branch to see every change again.
Explanations and your marks are saved in .git/branch-explainer.json in your repo, which git never commits. Each change is explained once; the next time it opens instantly.
Settings
| Setting |
Default |
What it does |
branchExplainer.baseBranch |
the master or main (local or on any remote) your branch is closest to |
Branch to compare with |
branchExplainer.language |
English |
Language of the explanations |
branchExplainer.model |
claude-haiku-5-5 |
Claude model; the lightest one keeps token use low |
branchExplainer.claudePath |
found through your login shell |
Full path to claude if it is not found |
branchExplainer.ignore |
build output, minified files, lock files, *.md, *.css |
Files to leave out and never explain (git glob pathspecs) |
branchExplainer.localUrl |
empty (previews off) |
Your local dev site, e.g. http://localhost:3000 |
branchExplainer.liveUrl |
empty (no live buttons) |
Your live site, e.g. https://example.com |
branchExplainer.previewPages |
empty |
Which page shows which files (see below) |
branchExplainer.chromePath |
usual install path for your OS |
Chrome used for previews |
UI previews
Tell the extension which pages show which files. In your workspace .vscode/settings.json:
{
"branchExplainer.localUrl": "http://localhost:3000",
"branchExplainer.liveUrl": "https://example.com",
"branchExplainer.previewPages": [
{ "files": "src/components/Header/**", "pages": ["/"] },
{ "files": "src/pages/search/**", "pages": ["/search", "/search?q=test"] }
]
}
The preview opens the first page at phone width. If the changed element is not fully on a phone screen, it uses desktop width. The changed element is found from the CSS classes the change adds, and outlined in pink. Run your branch on localUrl first, or the preview shows whatever that site is running.
What is sent to Claude
Only the lines of the change you open (plus 3 lines around them), or the first 200 lines of a file for About this file, and the file path. They go through your own Claude Code CLI with all tools turned off. Nothing is sent anywhere else.
Commands
- Branch Explainer: Next Change / Next File
- Branch Explainer: Explain All Changes in This File
- Branch Explainer: Refresh (it also refreshes on save and when the window gets focus)
- Branch Explainer: Toggle Highlights
Development
npm test # unit tests
npx @vscode/vsce package # build the .vsix
License
MIT