Skip to content

Fix Create & Switch to Branch upstream tracking from remote refs#5397

Draft
sergeibbb wants to merge 1 commit into
mainfrom
bug/5360-upstream-tracking
Draft

Fix Create & Switch to Branch upstream tracking from remote refs#5397
sergeibbb wants to merge 1 commit into
mainfrom
bug/5360-upstream-tracking

Conversation

@sergeibbb

@sergeibbb sergeibbb commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Passes --no-track to git checkout -b when creating and switching to a branch from a remote ref with a different name, matching the existing behavior of "Create Branch" (without switch)
  • Applies the same --no-track fix to git worktree add -b — creating a worktree from a remote ref with a different name also incorrectly set upstream tracking
  • Threads noTracking option through gitRepositoryService.switch() and createWorktree() down to their git implementations
  • Updates GitOperationsSubProvider and GitWorktreesSubProvider interfaces to include noTracking
  • Adds 3 unit tests verifying --no-track flag construction on checkout

Fixes #5360

Test plan

  • Unit tests pass (367/367) — 3 new tests for checkout with/without noTracking
  • TypeScript compiles cleanly
  • Live-tested "Create & Switch to Branch": created test-no-track-5360 from origin/mastergit branch -vv shows no upstream tracking
  • Reproduced worktree bug: git worktree add -b foo ... origin/master sets upstream; confirmed --no-track prevents it

🤖 Generated with Claude Code

Introduces a `noTracking` option to the `checkout` operation, allowing
`git checkout -b --no-track` to be used.

The `GitRepositoryService.switch` method now supports this option, which
is leveraged by the `branch create --switch` command. When creating a
local branch from a remote branch with a different name, the command
will now use `--no-track` to prevent automatic setup of a remote
tracking branch.

(#5360, #5397)
@sergeibbb sergeibbb force-pushed the bug/5360-upstream-tracking branch from 48f2ee8 to 219a19a Compare June 25, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating & switching to a new branch from a remote ref incorrectly sets upstream tracking

1 participant