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.
You can use the same techniques used to deploy to production to deploy a development branch of your application to a staging application on Heroku.
To see what's been deployed on the Heroku dashboard: Just click the Overview tab. You'll see an Activity view on the right that shows recent deployments with commit hashes.
First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch. Note: git merge merges the specified branch into the currently active branch.
If you want to push a different branch to Heroku you can do something like
git push heroku yourbranch:master
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With