Skip to content

Add git stack pr - #55

Merged
DomBlack merged 2 commits into
mainfrom
pr
Oct 16, 2026
Merged

DomBlack merged 2 commits into
mainfrom
pr

Conversation

@DomBlack

@DomBlack DomBlack commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Getting from a branch to its PR meant gh pr view --web, or copying the URL out of git stack log. Both work, but it's a lot of typing for something you do all day.

git stack pr [branch] (and git pr) opens the PR of the current branch, or the one you name, in your browser on a terminal. Piped, or with --print, it just prints the URL. It looks in the PR cache and gh stack's metadata first, and only asks GitHub when neither knows the branch's PR. A branch with no PR says so and points at git stack submit. If the browser won't open you get the link instead, not a failure.

No MCP tool for this on purpose, since agents already get every PR URL from stack_view. The git pr alias is skipped automatically for anyone with git-extras' own git-pr installed.

Getting to a branch's PR on GitHub means finding its number in git stack log and then clicking it, or going through gh with the branch name. The CLI should be able to just open it, and for that it needs to know a branch's PR without asking GitHub every time.

So there's a use case that looks a branch up (the current one by default) in the PR cache, then in gh stack's metadata, the same order the log uses. It only asks GitHub when neither knows the branch's PR, i.e. one opened by hand or since the cache was last filled. A number without a URL gets one from the forge's own URL scheme. A trunk, a branch that isn't in a stack and a branch with no PR yet each get their own error, the last one pointing at git stack submit.
Opening the PR for the branch you're on is something you do all the time while a stack is in review, and there was no quick way to do it from the terminal.

So git stack pr (and git pr) opens the current branch's PR in the browser, or a named branch's. It uses open on macOS and xdg-open elsewhere, and if that fails it prints the URL with a notice rather than failing. Without a terminal, or with --print, it just prints the URL, so it can be piped into something else.

There's no MCP tool for it on purpose: agents already get every branch's PR URL from stack_view, and an agent opening browser tabs isn't something we want. git pr isn't a git builtin; if some other installed command already has the name, install skips the alias like it does for any other clash.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 13:30
@DomBlack
DomBlack added this pull request to stack #59 October 16, 2026 13:30
@DomBlack DomBlack changed the title pr Add git stack pr Oct 16, 2026
@DomBlack DomBlack added the enhancement New feature or request label Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@DomBlack
DomBlack merged commit 165c255 into main Oct 16, 2026
5 of 6 checks passed
@DomBlack
DomBlack deleted the pr branch October 16, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants