I would like to have a command to open/browse an existing pull request.
Since pull-request is able to see if there's a pull-request already (at least when it tries to create one), this should be possible.
It should default to the current branch with its tracking remote/repo.
Related issue: https://github.com/github/hub/issues/880 - which is about displaying the URL to a pull request.
hub browse gets you most of the way there.
Yes, it helps in general.
But given https://github.com/github/hub/issues/896 you won't be on your fork / the branch necessarily.
(I assume that you mean that the branch is opened and you can click the link to the PR?!)
function github
set -l url
set -l branch (git rev-parse --abbrev-ref HEAD)
if test $status -eq 0
set url (hub pr list -f %U\n -h $branch)
end
if test -z $url
set url (hub browse -u)
end
python -mwebbrowser $url >/dev/null
end
Thats I use on macOS with fish, works really well.
git config --global alias.pr-open \
'!open $(hub pr list -f %U -h dwijnand:$(git rev-parse --abbrev-ref HEAD))'
to add a pr-open alias to your ~/.gitconfig
Replace dwijnand with your username, and open if not on macOS.
Suggest command name/structure:
$ git pr browse <#>
Example:
$ git pr browse 59
hub pr show has now landed in master https://github.com/github/hub/pull/2141
This is amazing, thank you 馃
That time when issue hangs in your subscription for more than two years and then it finally pays off 馃拑
@dentuzhik You're welcome! Credit goes to @ashemesh @hmemcpy @jsternberg et al who eventually made contributions towards the feature 鉂わ笍
Thanks very much for pushing it through! 馃帀
Most helpful comment
hub pr showhas now landed in master https://github.com/github/hub/pull/2141