views:

4712

answers:

1

I created a local branch which I want to 'push' upstream. There is a similar question here on Stackoverflow on how to track a newly created remote branch.

However, my workflow is slightly different. FIRST I want to create a local branch. And I will only push it upstream when I'm satisfied and want to share my branch.

How would I do that? (my google searches did not seem to come up with anything)

And how would I tell my colleagues to pull it from the upstream repository?

+19  A: 

The branch is automaticly created when you push it to the remote server. So when you feel for it, you can just do

git push <server-name> <branch-name>

Your colleagues would then just pull that branch, and it's automaticly created local.

Note however that formaly, the format is:

git push <server-name> <local-branch-name>:<remote-branch-name>

But when you ommit one, it assumes both names are the same.

Ikke
Thanks! i seem to mess up the syntax all the time
Jesper Rønn-Jensen
Note that default behavior of git is to push ***matching*** refs, so `git push <remote>` would not push branch if it is not present on `<remote>`.
Jakub Narębski