EnterWorktree: support base branch parameter

Resolved 💬 3 comments Opened Apr 14, 2026 by taige Closed Jul 2, 2026

Problem

EnterWorktree creates a new worktree based on HEAD. There's no way to specify a different base branch.

In Git Flow workflows (hotfix from master, feature from develop), you often need a worktree based on a branch that's not the current HEAD. Today's workaround is:

git worktree add .claude/worktrees/hotfix-xxx master -b hotfix/xxx

Then EnterWorktree(path=".claude/worktrees/hotfix-xxx") to enter it.

This works but has a drawback: ExitWorktree(action: "remove") refuses to clean up worktrees it didn't create, so cleanup requires manual git worktree remove + git branch -d.

Proposal

Add an optional base parameter to EnterWorktree:

EnterWorktree(name="hotfix-xxx", base="master")

This would run the equivalent of:

git worktree add .claude/worktrees/hotfix-xxx master -b worktree-hotfix-xxx

And since EnterWorktree created it, ExitWorktree(action: "remove") would handle full cleanup.

Use case

  • Hotfix workflow: working on feat/xxx, need to create hotfix/yyy from master without disturbing current work
  • Feature branches: create a new feature worktree from develop while on master

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗