Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to deploy to heroku from a custom branch?

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.

like image 936
Mohsin Sethi Avatar asked Oct 28 '25 19:10

Mohsin Sethi


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 
like image 92
Harshana Serasinghe Avatar answered Oct 30 '25 07:10

Harshana Serasinghe