Monday, April 20, 2015

How to Push a Local Branch to a Separate Remote Branch

This is my first post about Git! I'll be talking about how to push the contents of a local branch to a remote branch that is different from what it currently points to. The base syntax is

git push remote local_branch:remote_branch

An example of when to use this is in combination with Heroku. You might want to push your local branch to Heroku's master branch:

git push heroku foo_branch:master

That is also how you make Heroku run a non-master git branch.

Maybe you want to push the contents of your current branch to another branch on git:

git push origin foo_branch:bar_branch