I don’t know how many times I’ve been working on a feature branch and wanted to quickly browse to the associated pull request, but it’s a lot. Pull Requests are a GitHub concept, so git itself doesn’t really know about them (only the branch / HEAD that is stored there).
The gh command-line tool to the rescue!
Once you are logged in, you can issue the following command from your project directory:
gh pr view $(git branch --show-current) --web
With the --web flag, the pr view subcommand will open your default browser to your PR! Leave it out and you can see info about the PR right in your terminal — even comments.
I like to set it to an alias like this (in your bash / zsh profile config):
alias ghpr="gh pr view $(git branch --show-current) --web"
…so it’s easier to type and remember!
One of these days, I’ll have to take the oh my zsh plunge.
The gh command is supposed to grab my current branch, but for some reason it’s not (possibly related to this issue). That’s why I pull in the current branch with a tiny script.
Yay, computers!






