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.

footnote
footnote
Aug 23, 2017 · 2 min read
  1. Go get Homebrew if you don’t have it.
  2. Open terminal and get in to your working git directory (cd and all that).
  3. Run brew install hub
  4. Run git remote -v in your repo directory to check your origin is 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 the config file 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)
  5. Create your branch using git checkout -b newbranch and do your work. Run your git add . followed by git commit -m "testing pull-request" andgit push origin newbranch.
  6. Now, remaining on your working branch, run: hub pull-request -m "pull-request-message".
  7. You’re pull request is created. If you have Heroku setup for Review Apps, you’ll see it spin up straight away.
Push. Control.
Review.

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

)
footnote

Written by

footnote

Never lose an article again.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade