EnterWorktree creates branch from wrong commit (not current branch HEAD)
Resolved 💬 3 comments Opened Mar 2, 2026 by vkamenski Closed Mar 5, 2026
Bug Description
EnterWorktree creates a worktree branched from the wrong commit instead of the current branch's HEAD.
Steps to Reproduce
- Be on a feature branch (e.g. 3 commits ahead of
main) - Ask Claude Code to create a worktree
- The worktree is created from a commit several commits behind the current branch tip
Expected Behavior
The worktree should be created from the current branch's HEAD.
Actual Behavior
The worktree was created from an older commit — approximately main~1 — instead of the feature branch HEAD. The worktree ended up 3 commits behind the branch it was supposed to be based on.
$ git worktree list
/path/to/repo aaaa111 [feature-branch]
/path/to/repo/.claude/worktrees/xxx bbbb222 [worktree-xxx]
bbbb222 is not aaaa111 (feature branch HEAD) — it's an older commit.
Environment
- macOS Darwin 25.2.0
- Claude Code CLI
Impact
The worktree contains stale content (e.g., files deleted in recent commits still appear), which is confusing and can lead to working on outdated code.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗