Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save avtaniket/3de656b6f04e7eba40d107a524c333a8 to your computer and use it in GitHub Desktop.
Save avtaniket/3de656b6f04e7eba40d107a524c333a8 to your computer and use it in GitHub Desktop.
Adding multiple heroku apps to a single repository different branches
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 git@bitbucket.org:username/myapp.git (fetch)
origin git@bitbucket.org: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
@avtaniket
Copy link
Author

git push --force heroku-dev develop:master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment