Make Heroku run non-master Git branch

GitHeroku

Git Problem Overview


I have a project hosted on Heroku and it's gotten to the point where I want to make an alternate test server (so I can test Heroku workers without messing up production).

I have already set up my main Heroku remote running my trunk and a Heroku-dev remote on which I wish to run an alternate branch.

My problem is that since my alternate branch isn't master, Heroku won't build it.

$ git push heroku-dev test
counting objects ...
...
Pushed to non-master branch, skipping build.
To [email protected]:example-dev.git
* [new branch]      test -> test

Switching this build to master is not an option at the moment. Obviously one option is to create a whole new git repo that's a clone of my test branch, but that doesn't sound very ideal.

Git Solutions


Solution 1 - Git

You can push an alternative branch to Heroku using Git.

git push heroku-dev test:master

This pushes your local test branch to the remote's master branch (on Heroku).


Comment from @Brian Armstrong:

Worth noting also, when you're ready to go back to master you need to do

git push -f heroku master:master 

Solution 2 - Git

In my case, the default or base branch was develop, so i used:

          git push heroku develop:master 

Solution 3 - Git

In case git push heroku-dev test:master doesn't work for you, try git push heroku test:master. Remember the "test" in "test:master" is the name of the new branch you are on.

Solution 4 - Git

You will need to pull the remote branch first before you can push the non master branch.

Run following command in you local repository

git pull https://heroku:[email protected]/YOUR_APP_NAME.git

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexQueueView Question on Stackoverflow
Solution 1 - GitjordelverView Answer on Stackoverflow
Solution 2 - GitOkpoView Answer on Stackoverflow
Solution 3 - GitJohnView Answer on Stackoverflow
Solution 4 - GitkingkeamoView Answer on Stackoverflow