Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>Worktree SwitchNew to Visual Studio Code? Get it now.
Worktree Switch

Worktree Switch

Mehjig

| (0) | Free
Create, list, remove, and open git worktrees. Local-only. No AI.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Worktree Switch

Tiny VS Code extension: create, list, remove, and open git worktrees. One job.

Local-only. No AI. No cloud. No account. MIT licensed.

Run (F5)

  1. Open /home/box/worktree-switch in VS Code / Cursor.
  2. Install dependencies, then compile (see commands below). F5 also compiles via the default build task.
  3. Press F5 to launch the Extension Development Host.
  4. In the new window, open a git repository. Click the Worktrees activity bar icon (two-node worktree). The tree lists git worktree list.
  5. Use + in the view title to add a worktree. Right-click a worktree to Open (new window) or Remove.

Behavior

  • Tree is git worktree list --porcelain.
  • Add: QuickPick of local branches, plus New branch…. Picking a branch that already has a worktree errors instead of duplicating. New branch… prompts for a name (if that name already exists locally, it is treated as an existing branch — no -b). Creates a sibling folder <parent>/<repoName>-<sanitized> (slashes become hyphens: feat/foo -> myrepo-feat-foo), runs git worktree add (existing branch) or git worktree add -b (new branch), then opens that folder in a new VS Code window.
  • Open: selected worktree folder in a new window.
  • Remove: confirms with a modal, then git worktree remove <path> (no --force). Will not remove the main checkout (.git directory, not a .git file).
  • If git fails, stderr is shown and the command stops. Errors are not swallowed.
  • If the workspace is not a git repo, the tree shows Open a git repository.

Layout

  • src/extension.ts — activate, commands

  • src/worktreeProvider.ts — tree + add/remove/open

  • src/git.ts — spawn git with an args array; throw including stderr

  • Install: npm install

  • Compile: npm run compile (or just F5, which compiles)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft