Git – Make Heroku run non-master Git branch

githeroku

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 git@heroku.com: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.

Best Answer

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