Why do I need to explicitly push a new branch?

前端 未结 8 1526
遥遥无期
遥遥无期 2020-11-22 00:48

I am new in git and I am practicing. I created a local branch but I saw that when I did git push my branch was not uploaded to the repository. I ha

8条回答
  •  盖世英雄少女心
    2020-11-22 01:16

    I couldn't find a rationale by the original developers this quickly, but I can give you an educated guess based on a few years of Git experience.

    No, not every branch is something you want to push to the outside world. It might represent a private experiment.

    Moreover, where should git push send all the branches? Git can work with multiple remotes and you may want to have different sets of branches on each. E.g. a central project GitHub repo may have release branches; a GitHub fork may have topic branches for review; and a local Git server may have branches containing local configuration. If git push would push all branches to the remote that the current branch tracks, this kind of scheme would be easy to screw up.

提交回复
热议问题