MCPcopy Index your code
hub / github.com/alexiszamanidis/vscode-git-worktrees

github.com/alexiszamanidis/vscode-git-worktrees @v2.14.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.14.0 ↗ · + Follow
81 symbols 265 edges 17 files 0 documented · 0% updated 29d agov2.14.0 · 2026-04-25★ 751 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🧩 VS Code Git Worktrees

A wrapper for Git Worktree operations that provides an interactive API so developers can manage worktrees more easily — without switching between the terminal and VS Code.

🎯 Purpose of the Extension

After creating a ZSH plugin for Git operations, I noticed how often I switched between the terminal and my main editor (VS Code). To streamline my workflow, I built this extension to keep everything inside VS Code.

⚙️ Requirements

  • Git ≥ 2.34.1

🧪 Multiple Workspaces Support

This extension supports multiple workspaces. Here's how it works:

  • If you have more than one project open, you'll be prompted to choose the workspace to run the operation in.
  • If only one project is open, it is automatically selected.

✅ Select a workspace from the list → the operation will run in that workspace.

🛠️ Supported Operations

git worktree add [remote-branch] [new-branch]

Create a new worktree.

Behavior:

  • If you skip the new branch name (ESC), it defaults to using the same name as the remote branch.
  • Since worktree and branch names are often identical, the extension validates user input accordingly. 👉 See Issue #22

📄 git worktree list

Display all worktrees and switch between them easily via an interactive UI.

git worktree remove [worktree-name]

Remove an existing worktree.

Behavior:

  • If untracked or modified files exist, a ⚠️ popup will appear in the bottom right.
  • You can force delete by clicking the Force delete button in that popup.

Restrictions:

  • You cannot delete the worktree you're currently working in.

🚀 Getting Started

  1. 📦 Install the Git Worktrees extension from the VS Code Marketplace.
  2. 💡 Open the command palette: Ctrl + Shift + P
  3. 🔍 Search for any available operations > All commands are prefixed with: Git Worktree:

✨ Features & Operations

➕ Worktree Add (Create)

Create a new Git worktree with an intuitive interface.

worktree-add

🔁 Worktree List (Switch)

View and switch between all active worktrees with ease.

worktree-list

❌ Worktree Remove

Safely remove a worktree. If files are untracked or modified, you’ll get a prompt to confirm.

worktree-remove

⚠️ Error Handling

If something goes wrong, a helpful popup will appear at the bottom-right corner of your screen. Please don’t hesitate to open an issue if you encounter a bug.

error

⚙️ Extension Settings

Customize behavior using the following properties in your VS Code settings:

🏷️ Property 🧩 Type 🛠️ Default 📃 Description
vsCodeGitWorktrees.remove.stalledBranches boolean false Remove local (stalled) branches that no longer exist on the remote
vsCodeGitWorktrees.move.openNewVscodeWindow boolean true Open a new VS Code window when switching or creating a worktree
vsCodeGitWorktrees.worktrees.dir.path string null Define a directory for storing all your worktrees, e.g. ${userHome}/worktrees or /home/user/worktrees
vsCodeGitWorktrees.add.autoPush boolean true Automatically push the new worktree branch after creation
vsCodeGitWorktrees.add.autoPull boolean true Automatically pull updates after creating a new worktree branch
vsCodeGitWorktrees.worktreeCopyIncludePatterns array [] Files and folders to copy from the source repo to the new worktree, e.g. [".venv", "docs/tmp"]
vsCodeGitWorktrees.worktreeCopyExcludePatterns array [] Files and folders to exclude from the worktree copy, e.g. ["tmp", "target"]
vsCodeGitWorktrees.worktree.coloring boolean false Enable color labels when creating or switching worktrees
vsCodeGitWorktrees.worktreeSearchPath string null Optional subdirectory (relative or absolute) where Git repositories can be found if the root workspace is not a Git repository, e.g. ${userHome}/worktrees

Contributing

We welcome all contributions, issues and feature requests, whether small or large. If you want to contribute, feel free to check out our issues page and our guidelines.

Contributors

License

MIT © Alexis Zamanidis

Extension points exported contracts — how you extend this code

GetWorktreesTypes (Interface)
(no doc)
src/helpers/gitWorktreeHelpers.ts

Core symbols most depended-on inside this repo

debug
called by 67
src/helpers/logger.ts
info
called by 38
src/helpers/logger.ts
executeCommand
called by 21
src/helpers/helpers.ts
error
called by 18
src/helpers/logger.ts
warn
called by 9
src/helpers/logger.ts
write
called by 6
src/helpers/logger.ts
isGitRepository
called by 5
src/helpers/gitHelpers.ts
existsRemoteBranch
called by 5
src/helpers/gitHelpers.ts

Shape

Function 67
Method 11
Class 2
Interface 1

Languages

TypeScript100%

Modules by API surface

src/helpers/gitWorktreeHelpers.ts22 symbols
src/helpers/helpers.ts14 symbols
src/helpers/logger.ts13 symbols
src/helpers/gitHelpers.ts13 symbols
src/helpers/vsCodeHelpers.ts9 symbols
src/helpers/stringHelpers.ts5 symbols
src/extension.ts2 symbols
src/git/operations/worktree/gitWorktreeRemove.ts1 symbols
src/git/operations/worktree/gitWorktreeList.ts1 symbols
src/git/operations/worktree/gitWorktreeAdd.ts1 symbols

For agents

$ claude mcp add vscode-git-worktrees \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page