how to deploy to heroku from a custom branch?

Viewed 1228

I have 2 apps in Heroku, one is production app and one is staging. I have configured production app remote as 'heroku' and staging app remote as 'heroku-staging' so that I can deploy to production as follows

git push heroku master

and in staging as follows:

git push heroku-staging master

Now, I want to push code to staging app from my 'staging' branch instead of master branch. I want to accomplish this

git push heroku-staging staging  

If I run the above command, Heroku skips deployment saying branch is neither 'master' nor 'main' so skipping the build.

1 Answers

You can try the below command:

git push heroku-staging staging:master

When you want to go back, you can use the below command:

git push -f heroku master:master 
Related