EnterWorktree: support base branch parameter
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 createhotfix/yyyfrommasterwithout disturbing current work - Feature branches: create a new feature worktree from
developwhile onmaster
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗