views:

131

answers:

2

This feels like im missing something obvious, but i've been reading tutorials for 3 days and can't seem to make it happen.

I have a private repo on github. I want to run it as two separate branches. As I understand it, I clone the repo so its on my local machine, then branch it using

git branch newbranch

git checkout newbranch

so far so good. Now i make some changes, commit to newbranch. It seems like I can push this all to my remote repo intact, but I'm having trouble doing it without simply merging it with master, which is not what I want to do. How can I put my branches on github intact?

Is this the correct workflow for doing this? If it is, what am I doing wrong?

+4  A: 

this will only push the newbranch to origin/newbranch on github:

git push origin newbranch:newbranch
Tomas Markauskas
Thank you! This worked perfectly.
Vagabond_King
+2  A: 

Just:

 git push origin mybranch

should be enough; it will push the HEAD of the current branch you are in (not master, but the one you are working on) to a similary named branch. if the remote branch has not the same name, then

git push origin mybranch:remotebranch

git push uses a refspec to specify with what <src> object the <dst> ref in the remote repository is to be updated.

VonC