Category Archives: Heroku

Deploy any Git branch to your Heroku application

It’s pretty common on Heroku to have a staging app and a production app, with a Pipeline to promote changes from staging to production.

Typically if you use a pipeline, you write git push heroku master to push the latest master branch to your staging app and then promote it to production through the Heroku web UI.

But sometimes you may wish to temporarily test a different branch than master on your staging app. To do this, run:

git push heroku your-feature-branch:master

Where your-feature-branch is the name of the branch you want to deploy.

Remember that you shouldn’t promote this version to production. What you do is to merge the branch with master first after you’ve tested it and run git push heroku master to deploy the master branch to staging again before you finally promote your changes to production.