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

后端 未结 21 2033
南方客
南方客 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:34

    Because git has the cool ability to push/pull different branches to different "upstream" repositories. You could even use separate repositories for pushing and pulling - on the same branch. This can create a distributed, multi-level flow, I can see this being useful on project such as the Linux kernel. Git was originally built to be used on that project.

    As a consequence, it does not make assumption about which repo your branch should be tracking.

    On the other hand, most people do not use git in this way, so it might make a good case for a default option.

    Git is generally pretty low-level and it can be frustrating. Yet there are GUIs and it should be easy to write helper scripts if you still want to use it from the shell.

提交回复
热议问题