Creating A Github Pull Request Via CLI
So you’re using Github alongside Heroku, and you want to spin up Review Apps? Nice… Well, we know logging into GitHub to click buttons in the UI is fun and all, but it’s not great for the workflow. Here’s our brief step-by-step guide to triggering a pull request in the CLI for OS X.
Aug 23, 2017 · 2 min read
- Go get Homebrew if you don’t have it.
- Open terminal and get in to your working git directory (cd and all that).
- Run
brew install hub - Run
git remote -vin your repo directory to check youroriginis set to the correct remote repo. Make sure it’s https:// otherwise you’ll get an error saying it can’t be located. If it’s not you can jump in to theconfigfile inside your .git and amend it. N.B. We weren’t using Github Enterprise (you’ll need to whitelist your GHE URL to get that working) - Create your branch using
git checkout -b newbranchand do your work. Run yourgit add .followed bygit commit -m "testing pull-request"andgit push origin newbranch. - Now, remaining on your working branch, run:
hub pull-request -m "pull-request-message". - You’re pull request is created. If you have Heroku setup for Review Apps, you’ll see it spin up straight away.


N.B. You can alias your hub to git but we haven’t. Using the add on as is works for us.