[MODEL] keeps basing work on ancient abandoned origin/master branch

Resolved 💬 4 comments Opened Feb 25, 2026 by gthb Closed Mar 25, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude made incorrect assumptions about my project

What You Asked Claude to Do

Encountered repeatedly in cases like these:

  1. I ask Claude to "review changes in this branch" or otherwise compare/refer to the main branch
  2. Recently, I start Claude Code with claude -w to work in a worktree (even on a new branch that I intended for the work)

Important context: my repo's main branch is named main but an old remote branch exists on the origin remote ... called master. Last commit in March 2023.

What Claude Actually Did

In the “review changes in this branch” case, Claude takes the base branch to be origin/master (even though I have deleted the local branch master), and thus does its review/comparison over a massive diff of the last three years of work.

In the “start Claude Code with claude -w” case, it starts the worktree branch off the tip of origin/master (not main, and not the feature branch I was on when starting it) and so does its work off a three-year-old baseline. This is extra sneaky because the statusline _did not show the branch_ so I didn't notice — it just showed the worktree name twice:

gthb@skryabin eager-strolling-pearl (worktree-eager-strolling-pearl)

(... a separate issue that I've now worked around with a custom statusline script, so that I have a chance of noticing when Claude does this)

Expected Behavior

Claude should have taken the main branch to be main (a local branch that exists, and has last commit today) rather than origin/master (a branch that exists only in a remote and the last commit is almost three years ago. It seems to be very biased towards the name master as the main-branch name.

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

Happens nondeterministically, but this ought to give decent odds of reproducing it:

  1. Set up a repo with a branch named master that contains only very old commits, and a branch named main that contains very recent commits.
  2. Either start claude -w and do some work, or put a bunch of work on a branch off main and ask for a review of the changes (without mentioning the base branch by name)

Claude Model

Opus

Relevant Conversation

Impact

Medium - Extra work to undo changes

Claude Code Version

2.1.52 (Claude Code)

Platform

Anthropic API

Additional Context

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗