AlexQueue
AlexQueue

Reputation: 6541

Make Heroku run non-master Git branch

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.

Upvotes: 204

Views: 43070

Answers (4)

jordelver
jordelver

Reputation: 8432

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 

Upvotes: 410

Okpo
Okpo

Reputation: 417

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

          git push heroku develop:master 

Upvotes: 11

John
John

Reputation: 343

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.

Upvotes: 2

kingkeamo
kingkeamo

Reputation: 366

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

Upvotes: -4

Related Questions