wt switch: support --guess behavior for remote tracking branches
First off, thanks for building worktrunk — it's been a fantastic tool and has genuinely improved my daily workflow.
Feature request: wt switch support for remote tracking branches (à la git switch --guess)
When I want to create a worktree for a remote branch that doesn't exist locally yet (e.g. a teammate's branch), I currently have to do:
git fetch
git switch -c feature/foo origin/feature/foo # create local branch
git switch main # go back to main
wt switch feature/foo # now create the worktree
It would be great if wt switch feature/foo could automatically create a local tracking branch from origin/feature/foo when no local branch exists — mirroring the --guess behavior that git switch has enabled by default.
With that, the workflow would collapse to just:
git fetch
wt switch feature/foo
This comes up frequently when working in teams where you need to check out or review branches others have pushed.
this should work already! does it not? it shouldn't require the --guess
@claude do we have examples of this in docs?
Claude finished @max-sixty's task in 1m 23s —— View job
- [x] Search docs and help text for remote tracking branch /
--guessexamples - [x] Summarize findings
Findings
Yes — the behavior is documented, but only briefly. There's a single sentence in the wt switch help text (after_long_help in src/cli/mod.rs:273, synced to docs/content/switch.md and skills/worktrunk/reference/switch.md):
Without
--create, switching to a remote branch (e.g.,wt switch featurewhen onlyorigin/featureexists) creates a local branch tracking the remote — this is the standard git behavior and is preserved.
However, there are no examples showing this workflow. The Examples section only covers --create usage. An example like this could be added:
# Switch to a teammate's branch that only exists on the remote
git fetch
wt switch feature/foo
Let me know if you'd like me to add an example to the docs.
Oh, you're right — I had tried wt switch -c branch origin/branch (mimicking git switch -c) and assumed it wasn't supported when that failed. Just tested wt switch branch without -c and it works perfectly. Sorry for the noise, and thanks for the quick response!
no prob @SokiKawashima , thanks for raising
Let me know if you'd like me to add an example to the docs.
yes please @claude
Claude finished @max-sixty's task in 8m 25s —— View job • claude/issue-1076-20260217-0735 • Create PR ➔
- [x] Read
src/cli/mod.rsto find the switch command'safter_long_helpsection - [x] Add an example for switching to a remote tracking branch
- [x] Run doc sync test to update generated docs
- [x] Run full tests to verify nothing is broken
- [x] Commit and push changes
Added a remote tracking branch example in two places in the wt switch help text:
- Examples section — added
wt switch feature/foowith a comment noting it creates a local tracking branch - Creating a branch section — added a mini-example showing the
git fetch+wt switchworkflow right after the existing prose about remote branch behavior
All three files updated: src/cli/mod.rs (source of truth), docs/content/switch.md, and skills/worktrunk/reference/switch.md (auto-synced).