简体   繁体   English

git 内部结构:上游跟踪分支存储在哪里?

[英]git internals: where is upstream tracking branch stored?

I know that I can see which upstream branch is being tracked by a local branch by running git branch double verbose:我知道我可以通过运行git branch double verbose 查看本地分支正在跟踪哪个上游分支

dino@DINO:$ git branch -vv
  master         b567464 [origin/master] mav cross point example
  p516p          198bf21 [joesmith/master] start adding docs
  p516test       198bf21 start adding docs
* pull_507       4ceafac [soandso/master] restore blah blah blah.
  zorder         13f8d22 [origin/zorder] initial `zorder` tests

The remote tracking branch (if there is one) is shown in square brackets.远程跟踪分支(如果有的话)显示在方括号中。

My question is: where is this information , this association between the local branch and the remote branch, stored?我的问题是:这个信息,本地分支和远程分支之间的关联,存储在哪里?

I've poked around under .git/refs/ and .git/remotes/ , but I am unable to find anything, for example, that lists the association between branch p516p with remote joesmith/master .我在.git/refs/.git/remotes/下四处寻找,但我无法找到任何东西,例如,列出分支p516p与远程joesmith/master之间的关联。

(Notice that branch p516test points to the same reference as p516p , but p516test is not tracking any remote. I set it up that way on purpose, in hopes of finding where the tracking remote is stored, by comparing information for p516p with that for p516test ; no luck so far). (请注意,分支p516test指向与p516p相同的引用,但p516test未跟踪任何遥控器。我故意这样设置,希望通过比较 p516p 的信息与p516p的信息来找到跟踪遥控器的存储p516test ; 到目前为止没有运气)。

It's in .git/config .它在.git/config中。 For example:例如:

[branch "main"]
    remote = origin
    merge = refs/heads/main

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM