Option 1
Normally we can set upstream branch while pushing:
// on master branch
git push -u origin master // with "-u"
or
// on master branch
git push --set-upstream origin master
In this way, we'll set a upstream branch for current local branch and push local commits to that upstream branch.
Option 2
Set upstream branch without pushing
// on master branch
git branch -u origin/master
or
// on master branch
git branch --set-upstream origin/master
网友评论