Branch selector reverts to previously used branch instead of current git HEAD when navigating away and back
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The branch selector in the Claude Code UI does not reflect the current git HEAD after navigating away from the session and returning to it.
After merging a PR and switching back to main locally (git checkout main && git pull origin main), the Claude Code UI correctly shows main as the active branch on first load. However, if you navigate away (e.g., to the chat view) and then navigate back, the branch selector reverts to the previously used branch (e.g. SC-64399-infer-monthly-home-location) instead of the actual current branch (main).
This is misleading and potentially dangerous — a user could unknowingly start a new task on a stale/already-merged branch.
What Should Happen?
The branch selector should always reflect the actual current git HEAD when the UI is loaded or re-visited. It should read live git state rather than persisting stale session state from a previous interaction.
Error Messages/Logs
Steps to Reproduce
- Start a Claude Code session on branch
feature-branch - 2. Merge the PR for
feature-branchintomainon GitHub - 3. Locally run
git checkout main && git pull origin main - 4. Launch Claude Code — branch selector correctly shows
main✅ - 5. Navigate away from the Claude Code session (e.g., click to the Chat view)
- 6. Navigate back to Claude Code
- 7. Branch selector now shows
feature-branchinstead ofmain❌
The UI has reverted to the previously used branch rather than re-reading the current git HEAD.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
unknown (run claude --version to confirm)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗