63

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?

asked Sep 14, 2014 at 14:47

2 Answers 2

128

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.

answered Sep 14, 2014 at 14:50
Sign up to request clarification or add additional context in comments.

Comments

4
git push -f heroku otherBranch:master

The -f (force flag) is recommended in order to avoid conflicts with other developers’ pushes. Since you are not using Git for your revision control, but as a transport only, using the force flag is a reasonable practice.

source :- offical docs

answered Nov 9, 2019 at 2:35

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.