Question

Ok, so I have a big github project that i'm not supposed to merge my little Stacia branch into. However, it seems like Heroku only takes pushing MASTER seriously. It looks like I pushed my branch, but for example if I only have my branch, it even acts like there's no code on the server. I can't even get my gems installed since the .gems file is on my branch.

Basically I don't even want Heroku to know there's a master. I just want to use my test Stacia branch. But it keeps ignoring my local branch. Is there a way to do this? And again, I don't want to overwrite anything on the main Github repository (eeek!) but it would be ok probably if I had both master and my branch on heroku and merged them there.

I am a total git novice (on windows no less) so please bear with me.

Was it helpful?

Solution

The first step is make sure you have rebase your local branch on top of its master (Let's suppose it is in its repo 'mainGitHubRepo')

git fetch mainGitHubRepo master
git checkout -b mainGitHubMaster mainGitHubRepo/master

Then go back to your branch and replay it on top of mainGitHubMaster :

git checkout Stacia
git rebase mainGitHubMaster

As georgebrock mentions in the comment, you don't have to create the intermediate local branch mainGitHubMaster: you can directly rebase on top of the fetch branch.

git checkout Stacia
git rebase maingithubrepo/master

After that, you can push your branch to your GitHub fork, and then make a pull request.

To push a local branch to an established remote, you simply need to use:
git push REMOTENAME BRANCHNAME.
If you don’t want to use the same name on the remote branch you can use:
git push REMOTENAME LOCALBRANCHNAME:REMOTEBRANCHNAME.

(which is what David Dollar mentions in his answer: git push heroku yourbranch:master)

Note: if you have your own fork on GitHub, you could work directly on 'master' for this fork, meaning your pull request would come from a 'master' branch, enhancing your chances to be considered.
But the aforementioned process remains valid: your pull request must result in trivial merges for the one who will integrate your changes, hence the rebase step to be made locally.

OTHER TIPS

If you want to push a different branch to Heroku you can do something like

git push heroku yourbranch:master
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top