[BUG] `--worktree` creates worktree/branch based on wrong remote
Resolved 💬 3 comments Opened Mar 2, 2026 by kevinansfield Closed May 4, 2026
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?
My main branch is set to track upstream/main but claude --worktree always creates the branch based off origin/main which is rarely used and so usually very out of date.
What Should Happen?
Worktree creation should use the git tracking configuration or at least allow the remote it uses to be configured in settings.
Error Messages/Logs
Steps to Reproduce
- Set up two git remotes, in my case
upstream/main(primary work trunk) andorigin/main(rarely used fork) - Ensure local
mainis configured to track the right remotegit branch --set-upstream-to=upstream/main main - Make commits to
upstream/mainso that it is ahead oforigin/main - Run
claude -w - Inspect the created worktree/branch - it will be behind
upstream/mainbecause it's based offorigin/main
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.63
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 ↗