Repository navigation
Conversation
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.
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.
Getting from a branch to its PR meant
gh pr view --web, or copying the URL out ofgit stack log. Both work, but it's a lot of typing for something you do all day.git stack pr [branch](andgit 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 atgit 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. Thegit pralias is skipped automatically for anyone with git-extras' owngit-prinstalled.