I created a local branch which I want to \'push\' upstream. There is a similar question here on Stack Overflow on how to track a newly created remote branch.
Howeve
I've solved this by adding this into my bash ~/.profile
:
function gitb() { git checkout -b $1 && git push --set-upstream origin $1; }
Then to start up a new local + remote branch, I write:
gitb feature/mynewbranch
This creates the branch and does the first push, not just to setup tracking (so that later git pull
and git push
work without extra arguments), but actually confirming that the target repo doesn't already have such branch in it.