Skip to content

switch help refinements #3095

Closed
Closed

Description

@max-sixty

couple of refinements in wt switch --help:

          Branch name or shortcut

          Opens interactive picker if omitted. Shortcuts: '^' (default branch), '-' (previous), '@' (current), 'pr:{N}' (GitHub PR), 'mr:{N}' (GitLab MR)
  • I think these symbols should be using emphasis rather than '?
  • we fail to list the PR link

Pull requests and merge requests

The pr:<number> / mr:<number> shortcut and the PR/MR's web URL both resolve to its branch. For same-repo PRs/MRs, worktrunk switches to the branch directly. For fork PRs/MRs, it fetches the ref (refs/pull/N/head or
refs/merge-requests/N/head) and configures pushRemote to the fork URL.

  wt switch pr:101                                  # GitHub PR #101
  wt switch https://github.com/owner/repo/pull/101  # ...the same PR, by URL
  wt switch mr:101                                  # GitLab MR !101
  wt switch https://gitlab.com/owner/repo/-/merge_requests/101  # ...the same MR, by URL

Both work anywhere a branch is accepted, including --base.

Requires gh (GitHub) or glab (GitLab) CLI to be installed and authenticated. The --create flag cannot be used with a PR/MR reference since the branch already exists.

Forks: The local branch uses the PR/MR's branch name directly (e.g., feature-fix), so git push works normally. If a local branch with that name already exists tracking something else, rename it first.

Gitea (experimental): pr: is also compatible with Gitea via the tea CLI. Set [forge] platform = "gitea" in .config/wt.toml to opt in; worktrunk also auto-detects Gitea when the remote host contains gitea or when tea
login add has been run for the host.

Azure DevOps (experimental): pr: is also compatible with Azure DevOps via the az CLI (with the azure-devops extension). Set [forge] platform = "azure-devops" in .config/wt.toml to opt in; worktrunk also auto-detects
Azure DevOps from dev.azure.com and *.visualstudio.com remotes.

  • this is really "patchy" re Gitea / Azure. Instead, consolidate all notes about the different forges into a small comment at the bottom "Requires gh (GitHub), glab (GitLab) CLI, or equivalent to be installed and authenticated. See [wherever our help about the different forges is, probably in a wt config help subcommand?!] for details."
  • (e.g., feature-fix) totally superfluous (also look for other parenthesized items like this in --helps and remove them
  • so it should finish with Forks: The local branch uses the PR/MR's branch name directly (e.g., feature-fix), so git push works normally. If a local branch with that name already exists tracking something else, rename it first., and make this more prose-like; open with "if the PR is on a fork...", and don't use the imperative, use a descriptive mood; "it requires renaming"

Activity

  1. worktrunk-bot commented on Jun 16, 2026

    @worktrunk-bot
    Collaborator

    Picked these up in #3096:

    • Shortcuts in the [BRANCH] arg blurb now use backtick emphasis (rendered as bold), matching how --base already documented them.
    • Added "or PR/MR URL" to the [BRANCH] arg label so the short help acknowledges the URL form too.
    • Rewrote the Forks paragraph as prose, leading with "If the PR or MR is on a fork…" and switching to descriptive mood; dropped (e.g., feature-fix).
    • Folded the Gitea/Azure DevOps blurbs and the Requires gh/glab line into one footer pointing at the forge platform docs.

    I left the other (e.g., …) parenthetical in this section (Switching to a remote branch (e.g., wt switch feature when only origin/feature exists) creates a local tracking branch.) alone since it felt like it was clarifying what "remote branch" means rather than restating something obvious — happy to drop it if you'd rather. I didn't sweep the other commands' help pages this round.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions