You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, wt switch supports wt switch pr:123 as a shortcut to check out a GitHub Pull Request.
For better ergonomics, it would be very handy if it could also support, as an example, wt switch https://github.com/max-sixty/worktrunk/pull/2895, which should be equivalent to wt switch pr:2895.
The current behavior is the following:
x wt switch https://github.com/max-sixty/worktrunk/pull/2895
✗ No branch named https://github.com/max-sixty/worktrunk/pull/2895
↳ To create a new branch, run wt switch --create 'https://github.com/max-sixty/worktrunk/pull/2895'; to list branches, run wt list --branches --remotes (last fetched 13m ago)
Personally, I use this pattern quite often. It is the only feature I am missing in worktrunk so far (after migrating from a custom wt script I've been using before discovering worktrunk).
I would be happy to take a stab at implementing it and sending out a PR if you think it is desirable and makes sense.
Thanks for the kind words and the suggestion! I searched the codebase and confirmed there's no URL-aware parsing on the wt switch argument today — only the pr:{N} / mr:{N} literal prefixes are recognized. The current behavior you see is the regular branch-resolution path treating the URL as a branch name.
A few notes for whoever picks this up:
The PR-shortcut entry points are resolve_switch_target (for the positional arg) and resolve_base_ref (for --base), both in src/commands/worktree/switch.rs. They strip the pr: / mr: prefix then dispatch to the forge providers — a URL match would slot in at the same place.
For symmetry, GitLab MR URLs (https://gitlab.com/owner/repo/-/merge_requests/N) and GitHub Enterprise hosts probably want the same treatment. Worktrunk already handles non-github.com GitHub hosts in the forge layer (see #1408).
This would likely also extend naturally to --base https://.../pull/N.
I'll leave it for a maintainer to confirm they'd accept the feature before you spend time on a PR.
Activity
worktrunk-bot commentedon May 25, 2026
Thanks for the kind words and the suggestion! I searched the codebase and confirmed there's no URL-aware parsing on the
wt switchargument today — only thepr:{N}/mr:{N}literal prefixes are recognized. The current behavior you see is the regular branch-resolution path treating the URL as a branch name.A few notes for whoever picks this up:
resolve_switch_target(for the positional arg) andresolve_base_ref(for--base), both insrc/commands/worktree/switch.rs. They strip thepr:/mr:prefix then dispatch to the forge providers — a URL match would slot in at the same place.https://gitlab.com/owner/repo/-/merge_requests/N) and GitHub Enterprise hosts probably want the same treatment. Worktrunk already handles non-github.comGitHub hosts in the forge layer (see #1408).--base https://.../pull/N.I'll leave it for a maintainer to confirm they'd accept the feature before you spend time on a PR.
max-sixty commentedon May 25, 2026
yes, good idea, let's do this @worktrunk-bot.
have it as just a parenthetical in the docs pls