--worktree should use remote default branch, not hardcoded main
Problem
When using claude --worktree, the worktree branch is created from main regardless of the repository's actual default branch. In our case, staging is the default branch (confirmed via git remote show origin), but worktrees still branch from main.
This causes issues for repos that use a staging-based git flow where all feature branches should be based on staging, not main.
Expected behavior
--worktree should query the remote's default branch (e.g. git remote show origin | grep 'HEAD branch') and use that as the base, rather than hardcoding main.
Current workaround
Added a note to CLAUDE.md instructing Claude to rebase the worktree branch onto origin/staging before committing. This works but means every worktree session starts with an unnecessary rebase step.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗