Last Updated: February 25, 2016
·
673
· aaronmiler

Rebase & Push Non-Master Branch to Heroku

At the office our production servers are running MYSQL. But we love the simplicity of Heroku for staging our applications for QA.

Since we aren't using PG, I often make a Heroku config branch that I can just rebase in the changes I want to push to Heroku, and push it.

Given the argument of the configuration branch name, this command gets your current branch, checkouts the config branch, rebases it, and pushes it to Heroku all in one fell swoop.

I put this in my .zshrc for easy access.

function gph(){
  branchName=`git symbolic-ref -q --short HEAD`
  git checkout $1
  git rebase $branchName
  git push heroku $1:master -f
  git checkout $branchName
}