Git a remote branch

Git has it’s own work flow apart from other change management software. Branching is particularly easy, but slightly different than what one is used to. Typically, we create local branches in git to test out new ideas. Occasionally, these new ideas are good enough to share with other developers and suddenly we want a remote version of that remote branch.

We have already done this:

git checkout -b my_new_awesome_branch

We want to do this:

git push origin my_new_awesome_branch

That works, but then you don’t properly track the new branch. To include tracking as well, you would instead do:

git push origin origin:refs/heads/my_new_awesome_branch

That will create the remote branch. Cool, now lets push our changes to it…

git push origin origin/my_new_awesome_branch

In getting to this point you might run into snags, make sure you have committed everything and resolved all conflicts.

Now, you want to remove that remote branch?

git branch -r -d origin/my_new_awesome_branch

Done? Not quite…

git push origin my_new_awesome_branch

That clears it from the remote. Git is still pretty cool.