I simply do
git push -u origin localBranch:remoteBranchToBeCreated
over an already cloned project.
Git creates a new branch named remoteBranchToBeCreated
under my commits I did in localBranch
.
Edit: this changes your current local branch's (possibly named localBranch
) upstream to origin/remoteBranchToBeCreated
. To fix that, simply type:
git branch --set-upstream-to=origin/localBranch
or
git branch -u origin/localBranch
So your current local branch now tracks origin/localBranch
back.