Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

(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).

>Solution :

It’s in .git/config. For example:

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading