title: How do I push different branches to different heroku apps?
body: <p>I've been working on a web-app that gets pushed to heroku. The source is hosted on GitHub.</p>
  
  <p>So <code>git push</code> pushes the master branch to GutHub.</p>
  
  <p>My git branch 'master' is connected to Heroku app '<code>my-app-staging</code>'</p>
  
  <p>So <code>git push heroku</code> pushes the app to <code>my-app-staging.herokuapp.com</code></p>
  
  <p>I've created a new Heroku app which will be the 'production' app, let's call it '<code>my-app-prod</code>'.</p>
  
  <p>I have created a branch now called '<code>production</code>' (ie <code>git checkout -b production</code>) and I've run <code>git push -u origin production</code> to make it a managed branch at GitHub.</p>
  
  <p>I now want to link the <code>production</code> branch to <code>my-app-prod.herokuapp.com</code> such that, when switched to the <code>production</code> branch I can simply type <code>git push heroku</code> (or perhaps <code>git push prod-heroku production</code> or similar) and voila - the production branch is pushed to the production app.</p>
  
  <p>What's the recommended way to link my <code>production</code> branch to <code>my-app-prod</code> on Heroku?</p>
  
  <p>I've wallowed through <a href="https://devcenter.heroku.com/articles/multiple-environments#advanced-linking-local-branches-to-remote-apps">Heroku's own docs on this</a> but they all assume I've set up my apps using the <code>heroku create</code> CLI, not set up my apps via Heroku's website, however the following paragraph just makes my head spin:</p>
  
  <blockquote>
    <p>It’s simple to type <code>git push staging master</code> and <code>git push production master</code> when
    you’ve followed the steps above. Many developers like to take advantage of git’s
    branches to separate in-progress and production-ready code, however. In this sort
    of setup, you might deploy to production from your master branch, merging in changes
    from a development branch once they’ve been reviewed on the staging app. With this
    setup, pushing is a littler trickier:</p>
  </blockquote>
  
  <p>Where I want to end up is as follows:</p>
  
  <ol>
  <li>In branch <code>master</code>: (a) <code>git push</code> pushes code to GitHub, and (b) <code>git push heroku</code> pushes code to <code>my-app-staging</code> on Heroku</li>
  <li>In branch <code>production</code>: (c) <code>git push</code> pushes code to the <code>production</code> branch on GitHub, and (d) <code>git push heroku</code> pushes the <code>production</code> code to <code>my-app-prod</code> on Heroku.</li>
  </ol>
  
  <p>Given step 1 above is already in place and step 2 (c) is in place, how do I achieve step 2 (d)?</p>