Git Branch in Explorer
See at a glance which git branch every project is on — right in the Explorer file tree.
When several repositories are open at once — a multi-root workspace, or one folder holding many projects — answering "which branch is this project on?" means walking through the Source Control panel or checking each folder one by one. This extension puts the answer where you are already looking: a muted branch label next to each project folder, colour-coded by repository state.

EXPLORER (multi-root workspace) EXPLORER (plain folder of projects)
› api test-branch-123 › app main
› docs test-branch-124 › docs feature/new-layout *
› docker master
› admin main
The label is muted green when the repository is clean and in sync, amber when work is in flight (uncommitted changes, commits to push or pull, no upstream), red when it needs attention (conflicts, a rebase in progress, detached HEAD). The folder name itself keeps its normal colour.
Features
- The branch next to the folder, in the real file tree — not in a separate panel you have to open.
- Colour-coded state with compact counters:
* uncommitted, ↑2 to push, ↓1 to pull.
- Multi-root and plain folders — labels workspace roots of a
.code-workspace, and repositories nested inside an opened folder (configurable scan depth).
- Reads git directly — the branch comes from
.git/HEAD, the state from git --no-optional-locks status --porcelain=v2. Any host works: GitHub, GitLab, Bitbucket, self-hosted, none.
- Stays live — its own
fs.watch on the git directory picks up checkouts made from a terminal or another tool within a moment, even when files.watcherExclude mutes **/.git/** (a common memory-saving trick that silences the built-in git extension).
- Touches nothing of yours — no writes to the
.code-workspace file, folders[].name, or any settings outside branchInExplorer.*.
How it works — read before installing
VS Code's extension API cannot append text to a row of the Explorer tree (the request was closed as out of scope). The only way to draw the label is to patch the workbench, and this extension is transparent about it:
- One marker-tagged
<script> line is added to workbench.html inside your VS Code installation, and two files are placed next to it: the renderer script and a JSON data file.
- The extension host keeps that JSON up to date with every repository's branch and state; the injected script polls it and decorates the matching folder rows.
- The file checksum in
product.json is kept in sync, so VS Code shows no "installation is corrupt" warning.
This requires write access to the VS Code installation — standard user-level installs on macOS and Windows qualify; system-wide installs (e.g. /usr/share on Linux, machine-wide on Windows) would need elevation, and patching simply fails with an error there.
After every VS Code update the patch is reverted together with the rest of the application files. The extension notices on the next start and offers Patch and Reload — one click.
To remove cleanly: run Git Branch in Explorer: Remove Workbench Patch (restores workbench.html byte for byte and deletes the two files), reload the window, then uninstall the extension.
Commands
| Command |
What it does |
Git Branch in Explorer: Apply Workbench Patch |
Patches workbench.html and reloads the window. |
Git Branch in Explorer: Remove Workbench Patch |
Restores the original files — run before uninstalling. |
Git Branch in Explorer: Refresh Branches |
Rescans folders and re-reads git state. |
Settings
| Setting |
Default |
What it does |
branchInExplorer.showMarkers |
true |
* ↑2 ↓1 counters next to the branch. |
branchInExplorer.scanDepth |
2 |
How deep to search for repositories below an open folder that is not itself a repository. |
Limitations
- If the opened folder is itself the repository, it has no row of its own in the tree — the status bar already shows that branch.
- Rows are matched by visible name and tree depth; two same-named folders at the same depth across windows can receive the same label.
- Compact folders (
explorer.compactFolders) are handled heuristically: the label attaches to the last segment of the chain.
- Remote workspaces (SSH, WSL, Dev Containers) and vscode.dev are not supported.
License
Copyright © 2026 Ihor Petrov. All rights reserved. See the license.