Claude Code 2.1.128: EnterWorktree Now Creates Branches from Your Current HEAD
Claude Code 2.1.128 corrects a long-standing EnterWorktree bug where new worktree branches were incorrectly forked from origin/
Sources & Mentions
5 external resources covering this update
[Bug] EnterWorktree creates worktree from default branch instead of HEAD · Issue #27134
GitHub
EnterWorktree creates branch from main instead of current branch HEAD · Issue #44965
GitHub
Releases · anthropics/claude-code
GitHub
The Claude Code Git Worktree Pattern: A Primer for Builders
MindStudio
An update on recent Claude Code quality reports
Hacker News
The EnterWorktree Branch Source Bug
For developers using Claude Code's built-in git worktree support — which enables parallel agents to work in isolated branches without interfering with each other — version 2.1.128 delivers a critical behavioral correction that eliminates a subtle data loss scenario.
What Was Wrong
The EnterWorktree tool's documentation explicitly stated it would "create a new git worktree branched from HEAD." In practice, the implementation branched from origin/<default-branch> — typically origin/main — rather than from the local working branch's HEAD. The consequence was significant for any team doing active feature development: if a developer was on a feature branch with unpushed commits and used EnterWorktree to spin up a parallel agent, the new worktree would start from main, not from the feature branch. Those unpushed commits would be effectively invisible to the spawned agent, leading it to work against stale or incorrect file contents.
Why It Matters for Worktree Workflows
Git worktrees are central to Claude Code's parallel agent architecture. The pattern — assigning each agent its own isolated worktree so multiple tasks can proceed simultaneously — assumes that the spawned worktree reflects the developer's current work, not some divergent remote baseline. When the branch source was wrong, agents could produce changes that conflicted with or overwrote in-progress feature work. The bug also surfaced in Agent(isolation: "worktree") calls, where the agent would silently start from main contents, and any merged-back changes could overwrite feature branch code.
The Fix
Claude Code 2.1.128 corrects EnterWorktree to create the new branch from local HEAD as documented. Two GitHub issues (#27134 and #44965) that tracked this behavior are now resolved. Developers using worktree-based parallel agent workflows can trust that newly spawned worktrees accurately reflect their current branch state, including any commits not yet pushed to the remote.