[BUG] New session branch is created from first repository commit instead of selected branch HEAD
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?
When starting a new Claude Code session and selecting an existing branch (e.g. main), the working branch created for the session is based on the repository's very first commit rather than the current HEAD of the selected branch. This means the session starts with a completely outdated codebase — in my case, over 150 commits behind — causing Claude to reference removed dependencies, outdated architecture, and deleted code as if they were still present.
What Should Happen?
New sessions should start from updated branch, getting all the stuff that this branch actually have in it.
Error Messages/Logs
As show below, I've selected "main" branch (that have almost 200 commits) and started a new session....my first prompt was:
Could you run for me:
git log --oneline
The result:
<img width="800" height="221" alt="Image" src="https://github.com/user-attachments/assets/20594f76-106b-45f9-9cf1-ba8707b64e04" />
<img width="495" height="308" alt="Image" src="https://github.com/user-attachments/assets/e0ce95d3-8ef3-4082-be7e-c9bb152ab487" />
After manually running git rebase origin/main, the branch correctly moved to the current HEAD and all outdated references disappeared
This have been happening both in Cloud Code desktop for mac and claude.ai/code.
I'm using Claude Code for Mac 1.5354.0 as show below:
<img width="321" height="361" alt="Image" src="https://github.com/user-attachments/assets/714e4c11-9dfe-4299-a20f-06aed842d387" />
Steps to Reproduce
- Go to "new session" and select a repo and branch with a lot of commits
- Start a session and check if it's updated based on it's branch actual state
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude 1.5354.0 (9a9e3d) 2026-04-29T01:14:34.000Z
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗