Repository navigation
Add wt pr for picking and switching to pull request branches - #18
Merged
Merged
Conversation
added 2 commits
November 22, 2026 23:03
wt pr shows open PRs (#number, title, branch) in the picker and wt pr 123 goes straight to a PR. Before switching, a local branch strictly behind origin/<branch> needs a yes to fast-forward; a diverged branch is rejected and a missing one is created from the remote tip. Switching reuses the normal worktree path / switch-or-worktree prompt flow.
The shell wrapper prepends --path-only, so the PR command was treated as a normal picker invocation. Find the first non-flag argument instead of assuming the subcommand is argv[1].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
wt prfor switching to GitHub pull request branches.wt prlists open PRs as#number title (branch)rows in the existing picker; the PR picker disables the mark/delete/force keys and filters on title too.wt pr 123goes straight to that PR. Both forms accept--no-color,--worktree-root DIRand--path-only, before or after the number.wtfetches the PR head fromorigin. A local branch strictly behindorigin/<branch>promptsFast-forward ...? [y/N]; yes runsgit merge --ff-onlyin its worktree, or a fast-forward ref update for a plain branch. Declining leaves the branch alone. A diverged branch is an error and is left untouched; a missing branch is created from the remote tip without asking.wtrules: a worktree returns its path, a plain branch shows the[s]witch here / [w]orktreeprompt.Why
PR branches are the main units of work in the parallel-agent workflow; finding and switching to one should not mean leaving
wtand running gh/git by hand.Verification
make build fmt-check vet test-race— all pass.gh pr list/viewJSON parsing and exact command shape,preparePRBranchWithcommand sequence and consent paths, PR-picker rendering/filter/key disabling, sequential stdin answers.ghand a real bare origin:wt pr 123 --no-colorwith answersythensfast-forwarded the branch and switched to it.Note
PR heads are resolved as
origin/<branch>; fork PR heads are not supported.