Created
May 30, 2017 04:30
-
-
Save amratab/f0402023194be56c7569fea08e249631 to your computer and use it in GitHub Desktop.
Adding multiple heroku apps to a single repository different branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose you have two heroku remote apps | |
myapp-dev & myapp-prod | |
and two git branches | |
master(for dev) & production | |
Now lets setup heroku on the existing git repo in your local machine | |
Assuming the branches and the apps exist already | |
git remote add heroku-myapp-dev https://git.heroku.com/myapp-dev.git | |
git remote add heroku-myapp-prod https://git.heroku.com/myapp-prod.git | |
git remote -v | |
should show something like this | |
heroku-myapp-prod https://git.heroku.com/myapp-prod.git (fetch) | |
heroku-myapp-prod https://git.heroku.com/myapp-prod.git (push) | |
heroku-myapp-dev https://git.heroku.com/myapp-dev.git (fetch) | |
heroku-myapp-dev https://git.heroku.com/myapp-dev.git (push) | |
origin [email protected]:username/myapp.git (fetch) | |
origin [email protected]:username/myapp.git (push) | |
Now if you want to push your master branch to a particular heroku app | |
git push heroku-myapp-prod master | |
To push the other branch(production being the other branch) | |
git push heroku-myapp-prod production:master |
Thanks so much
Thanks
I suspected this was possible but wasn't sure cuz heroku use a different git notation to set the default remote. Thanks a lot!
hello please i have a question.
Assuming I have two Apps created by heroku example (the 1st has the name 'www.herokuapp.vexhub.com' and another 'www.herokuapp.winword.com')
Now how do I push to any of the apps respectively, like pushing to the 1st or the 2nd?
Thanks
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
super helpful, thanks!