Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push different branch to Heroku

Tags:

git

heroku

Just finised work on my other branch. Now I need to test that this works on Heroku before I merge with the master branch.

Is it possible to push the other branch to Heroku and it replace the contents of my last push which was from the master branch?

like image 403
tommyd456 Avatar asked Sep 14 '14 14:09

tommyd456


People also ask

Can I push a different branch to Heroku?

Heroku only deploys code that you push to the master or main branches of the remote. Pushing code to another branch of the heroku remote has no effect.

How do I push to another Heroku app?

Head over to your heroku dashboard again, create a new app, go to it's settings tab and copy the heroku git url: https://git.heroku.com/sdk-heroku-staging.git , add it as aremote destination to your local repo: git remote add staging https://git.heroku.com/sdk-heroku-staging.git , here, “staging” is the name of our ...

Can you push to Heroku without GitHub?

You can use https://github.com/ddollar/heroku-push and push directories without git.


1 Answers

Yes, pushing to a branch named differently that your current one is possible using the syntax:

git push heroku other:master 

This tells Git to push the contents of your other branch to the master branch on the heroku remote. Keep in mind that you may have to force push if there are commits on heroku/master that don't appear in your other branch.

For more information have a look at the documentation of the <refspec> option to git push.

like image 162
amgaera Avatar answered Sep 20 '22 18:09

amgaera