Pushing a different branch to Heroku

how-to
Sep 24, 20111 min

I’m a huge fan of git-flow; it’s branching model facilitates a release model, supporting multiple versions and branches, quite nicely. For instance, during a development phase, all commits are made to the develop branch; consequently, when it’s time to push a release into production, a release branch is created, which essentially merges everything in develop into master.

During development, however, its handy to push a snapshot of a Git repository into Heroku; which by default, receives anything from master. That is, if you aren’t careful when pushing to Heroku, you’ll end up pushing the state of master to it rather than your intended branch, which is, in this case, develop.

Accordingly, to push a branch other than master to Heroku (for instance, develop when using git-flow), you push as follows:

Note, in this case, develop is being pushed to the Heroku instance named remote_name (i.e. staging, test, etc).

andrew_glover

When Andrew Glover isn't listening to “Funkytown” or “Le Freak” he enjoys speaking on the No Fluff Just Stuff Tour. He also writes articles for multiple online publications including IBM's developerWorks and O'Reilly’s ONJava and ONLamp portals. Andrew is also the co-author of Java Testing Patterns, which was published by Wiley in September 2004; Addison-Wesley’s Continuous Integration; and Manning’s Groovy in Action.

More from this author