Why do I need to do `--set-upstream` all the time?

后端 未结 21 2273
南方客
南方客 2020-11-22 09:15

I create a new branch in Git:

git branch my_branch

Push it:

git push origin my_branch

Now say someone mad

21条回答
  •  轮回少年
    2020-11-22 09:38

    You can set upstream simpler in two ways. First when you create the branch:

    git branch -u origin/my-branch
    

    or after you have created a branch, you can use this command.

    git push -u origin my-branch
    

    You can also branch, check out and set upstream in a single command:

    git checkout -b my-branch -t origin/my-branch
    

    My personally preference is to do this in a two-step command:

    git checkout -b my-branch
    git push -u origin my-branch
    

提交回复
热议问题