git - How do I push different branches to different heroku apps? -


i've been working on web-app gets pushed heroku. source hosted on github.

so git push pushes master branch guthub.

my git branch 'master' connected heroku app 'my-app-staging'

so git push heroku pushes app my-app-staging.herokuapp.com

i've created new heroku app 'production' app, let's call 'my-app-prod'.

i have created branch called 'production' (ie git checkout -b production) , i've run git push -u origin production make managed branch @ github.

i want link production branch my-app-prod.herokuapp.com such that, when switched production branch can type git push heroku (or perhaps git push prod-heroku production or similar) , voila - production branch pushed production app.

what's recommended way link production branch my-app-prod on heroku?

i've wallowed through heroku's own docs on this assume i've set apps using heroku create cli, not set apps via heroku's website, following paragraph makes head spin:

it’s simple type git push staging master , git push production master when you’ve followed steps above. many developers take advantage of git’s branches separate in-progress , production-ready code, however. in sort of setup, might deploy production master branch, merging in changes development branch once they’ve been reviewed on staging app. setup, pushing littler trickier:

where want end follows:

  1. in branch master: (a) git push pushes code github, , (b) git push heroku pushes code my-app-staging on heroku
  2. in branch production: (c) git push pushes code production branch on github, , (d) git push heroku pushes production code my-app-prod on heroku.

given step 1 above in place , step 2 (c) in place, how achieve step 2 (d)?

you should add remote my-app-prod named prod-heroku (replace git_url git url can find in settings page of my-app-prod in heroku):

git remote add prod-heroku git_url git push prod-heroku production:master 

this push local branch production remote branch master in prod-heroku my-app-prod deployed code in production branch.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -