gitStatus context reports wrong branch when launched with -w <worktree>
Resolved 💬 3 comments Opened Apr 27, 2026 by azarovalex Closed May 30, 2026
When launching Claude Code with claude -w <worktree-name>, the session's CWD is correctly set to the worktree directory, but the gitStatus snapshot in the initial system context reports the branch of the main checkout rather than the worktree's branch.
Repro:
- In a repo with a worktree (e.g.
.claude/worktrees/my-worktree) checked out to branchB, with the main checkout on branchA. - Launch
claude -w my-worktree. - Ask Claude what branch it's on — it will answer with
A(from the stalegitStatussnapshot). - Running
git branch --show-currentcorrectly reportsB.
Expected: gitStatus reflects the branch of the worktree the session was launched into.
Impact: Claude answers questions about current branch state incorrectly until it runs a git command, since it trusts the initial snapshot.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗