[BUG] 3+ hours lost at the start of a session just recovering from what the previous session's cold start broke.
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?
Expected behavior:
Claude should check git log --all --oneline and compare branch heads before making any commits, and warn the user if the current branch appears to be significantly behind other branches in the same repo.
Actual behavior:
Claude operates confidently on the current branch with no awareness that other branches exist with more recent work. Infra changes (deploy workflow, Docker config, SSL config) get committed and deployed, breaking the live site. Feature code from 107 commits across 3 weeks was inaccessible until manually merged.
Impact:
3+ hours of recovery time. Live site was down for part of that time. No data was permanently lost (git history preserved everything) but it required deep git forensics to identify and recover.
What Should Happen?
At session start, run git log --all --oneline and surface a warning if the current branch is significantly behind another branch, asking the user which branch to work from before proceeding.
Error Messages/Logs
Steps to Reproduce
Title: New session starts from wrong branch base, silently overwrites months of feature work
Steps to reproduce:
Have an active project with multiple Claude Code sessions over weeks, each on a different claude/... branch
Start a new Claude Code session
Ask Claude to rename the current branch or do any simple task
Claude reads CLAUDE.md (if it exists) but has no awareness of which branch in the repo has the most recent feature work
Claude begins making and committing changes on a branch that is 100+ commits behind the most feature-complete branch
Changes get pushed and deployed — overwriting the live server with months-old code
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude Code 2.1.123
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 ↗