Sometimes git will track all remote git branches as local branches without me asking to. What happened?

你。 提交于 2019-12-23 13:22:34

问题


sometimes, git will spontaneously (during some, but not all, "pull" or "clone" operations) copy all of the remote branches of a repository into my local repository (and even set them all up to track the corresponding remote branches correctly). What causes this? Is there a way I can do this on purpose?


回答1:


If you just do a normal branch from a remote branch, it'll track by default:

git checkout -b somebranch origin/somebranch

means roughly the same thing as

git checkout -t origin/somebranch

You pretty much have to explicitly tell it if you don't want such tracking.




回答2:


If you know the name of the remote branch you want to track, you can just do:

git checkout somebranch

It will say something like:

Branch somebranch set up to track remote branch badges from origin.


来源:https://stackoverflow.com/questions/415433/sometimes-git-will-track-all-remote-git-branches-as-local-branches-without-me-as

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!