Display Github PR Number of Your Current Branch

May 24, 2020

To display the PR number of your current branch, you can run:

$ hub pr list -f "%I%n" -h "$(git rev-parse --abbrev-ref HEAD)"

It’s handy if you are working on multiple feature branches. Also, if your Heroku apps are named with Github PR numbers, this command can help to programmatically figure out the app’s name.

This command is based on hub extension. For Mac users, you can install with

$ brew install hub