Git Branch Explorer
A VS Code extension that shows a Git repository the way Unity Plastic SCM's Branch Explorer does:
- every branch is its own horizontal lane, and time runs left → right
- commits are circles with the author's initials, one color per author
- green curves show merges, and dashed curves show where a branch started
- the checked-out commit has a dashed green ring and a 🏠 badge, and its branch is highlighted
- light vertical bands mark days, with sticky date headers and sticky lane names
- a dashed line splits Cloud (top: history already on a remote, e.g.
origin/main) from Local (bottom: your own work). A pull shows up as a merge crossing the line, and the status bar counts unpushed commits
- the Local zone always shows the branch you have checked out, highlighted at the top, ending in a working-tree node: orange with a count when you have uncommitted changes, red when there are conflicts, a hollow ✓ when clean. It hangs off the commit you're on, even when that commit is already pushed. Unpushed branches are stacked below it
Use it
Open a folder that is a Git repository, then either:
- open the Source Control sidebar and expand the Branch Explorer view, or
- run Git: Open Branch Explorer from the Command Palette (or click the branch icon in the Source Control title bar) to open it in an editor tab.
Requires git on your PATH.
In the explorer
| Do this |
To |
| Drag |
pan |
Mouse wheel / pinch, + / - |
zoom |
| Shift + wheel |
scroll sideways |
F / H |
fit the branches in view at a readable zoom / go to HEAD |
| Click a commit |
show details (click a parent to jump to it) |
| Hover a commit |
show a tooltip |
| Click the working-tree node |
list the changed files (click one to open its diff) and jump to Source Control |
| Right-click a commit or lane name |
Checkout, Create branch here, Merge into current branch, copy hash or message |
Ctrl+F |
find by message, sha, author or branch (Enter goes to the next match) |
It refreshes on its own whenever HEAD or any ref changes (commit, checkout, fetch, merge…). Edits to files only re-read git status, so the working-tree node stays current while you type and save.
Settings
gitBranchExplorer.maxCommits (default 2000)
gitBranchExplorer.mainBranchNames: trunk branches, drawn on top (default main, master, develop, dev)
How lanes are worked out
Plastic records which branch each changeset was made on. Git does not, so the extension works it out:
- Trunk branches claim their first-parent chain first.
- Every other branch claims its first-parent chain back to a commit that's already claimed. If the branch's reflog says where it was created (
branch: Created from …), it stops there, so a branch made from another branch doesn't take its parent's commits.
- Commits of branches that were merged and then deleted get a lane named from the merge message (
Merge branch 'x', Merge pull request #n from user/x), marked (deleted).
- Anything left over (detached HEAD, tag-only history) gets a lane of its own.
Every commit that a remote-tracking branch can reach goes in the cloud zone; everything else is local. Lanes never cross the line, so origin/x and an unpushed x get separate lanes, and a local branch that's in sync with its remote shows up as a badge on the cloud commit. Repos without a remote get no split.
Development
npm install
npm run demo-repo: builds a dummy repo at ../GitBranchExplorer-DemoRepo (run it again any time to rebuild it)
- Press F5 ("Run Extension (demo repo)"). A new VS Code window opens on the demo repo.
npm run check-layout [repo] prints the inferred lanes as a text grid, so you can debug the layout without VS Code.
To build a local package: npm run package (→ git-branch-explorer-<version>.vsix), then code --install-extension git-branch-explorer-<version>.vsix.
| |