I want to be able to do the following:
Create a local branch based on some other (remote or local) branch (via git branch or git checkout
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.