Flex Worktree Manager
Switch between git worktrees instantly without leaving your multi-root VS Code workspace. No stashing, no checkout delays — just swap the folder path and keep working.
How It Works
Flex Worktree manages a flex-workspace.yaml file that maps repository names to their current worktree paths. When you switch branches, it hot-swaps the workspace folder to point at a different worktree directory — VS Code stays open, your other workspace folders stay untouched.
Features
- Switch Worktree — Pick a repo and branch, swap to the corresponding worktree
- Create Worktree — Spin up a new worktree for any branch directly from VS Code
- Delete Worktree — Clean up worktrees you no longer need
- GitLens Integration — Right-click any branch or worktree in GitLens → "Switch to branch using worktree"
- Status Bar — See which worktree/branch is active at a glance
- pnpm-workspace.yaml — Automatically updates pnpmfile paths when swapping
Requirements
- Git with worktree support (2.5+)
- A
flex-workspace.yaml in your workspace root
- GitLens (optional, for branch/worktree context menus)
Setup
- Create a
flex-workspace.yaml in your workspace root:
workspaceName: my-project
repositoryPaths:
- name: backend
path: ../backend
- name: frontend
path: ../frontend
- Open the folder containing this file as part of a multi-root workspace
- The extension activates automatically
Commands
| Command |
Description |
Flex: Switch Worktree |
Switch a repo to a different worktree via QuickPick |
Flex: Create Worktree |
Create a new worktree for a branch |
Flex: Delete Worktree |
Remove an existing worktree |
Flex: Switch to branch using worktree |
Context menu in GitLens branch/worktree views |
How Worktrees Are Organized
The extension expects worktrees to live alongside the main repo:
project/
├── backend/ ← main worktree
├── backend.worktrees/
│ ├── feature-x/ ← worktree for feature-x branch
│ └── bugfix-y/ ← worktree for bugfix-y branch
├── frontend/
└── frontend.worktrees/
└── feature-x/
When you switch to feature-x on the backend repo, the workspace folder path updates from backend/ to backend.worktrees/feature-x/ seamlessly.
Extension Settings
This extension doesn't add VS Code settings. Configuration lives entirely in flex-workspace.yaml.
Known Limitations
- The GitLens context menu shows on all branches including the current one (VS Code
when clauses can't dynamically match against the current worktree path). Clicking it on the active branch shows "Already on that worktree".
Publisher: Eye-share