Worktree branches should not set origin/master as upstream

Resolved 💬 2 comments Opened Mar 26, 2026 by japaz Closed Mar 26, 2026

When using claude -w (worktree mode), the created branch sets origin/master as its upstream. This is problematic for the common workflow where pushing directly to master is not allowed (branch protection) and a PR is required.

Current behavior:

  • New worktree branch is created tracking origin/master
  • git status shows misleading ahead/behind counts relative to master
  • git push without arguments fails or targets the wrong branch

Expected behavior:

  • Create the branch with no upstream set
  • Let the upstream be set naturally on first push via git push -u origin HEAD

This is the safest default for repos with branch protection, where the workflow is always: create branch → push → open PR. Having no upstream avoids confusion and prevents accidental pushes to the wrong target.

View original on GitHub ↗

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