有时候git会在没有我要求的情况下将所有远程git分支作为本地分支进行跟踪。发生了什么? [英] Sometimes git will track all remote git branches as local branches without me asking to. What happened?

查看:160
本文介绍了有时候git会在没有我要求的情况下将所有远程git分支作为本地分支进行跟踪。发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,git会自发地(在一些,但不是所有的拉或克隆操作过程中)将存储库的所有远程分支复制到我的本地存储库(甚至将它们全部设置为跟踪相应的远程正确分支)。这是什么原因?有没有一种方法可以做到这一点?

解决方案

如果您只是从远程分支执行普通分支,默认情况下:

  git checkout -b somebranch origin / somebranch 

的含义与

  git checkout -t origin / somebranch 

如果您不想要这样的跟踪,您几乎必须明确地告诉它。 / p>

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?

解决方案

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.

这篇关于有时候git会在没有我要求的情况下将所有远程git分支作为本地分支进行跟踪。发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆