Re: [PATCH v2 0/5] root refs vs pseudorefs

From
Julia Evans <hidden>
Date
2026-11-03 14:36:38
Reply to
Andy Koppe, 2026-11-02
pseudoref
    A name that can be used like a ref to refer to an object, but that
    is not stored in the same way as refs. For example, pseudorefs can
    be passed to git-log(1) or git-diff(1), but they cannot be written
    by git-update-ref(1) or listed by git-for-each-ref(1).

    The following pseudorefs are known to Git:

    •   FETCH_HEAD is written by git-fetch(1) or git-pull(1). It may
        refer to multiple object IDs. Each object ID is annotated with
        metadata indicating where it was fetched from and its fetch
        status.
I found "Each object ID is annotated with metadata  indicating where it was
fetched from and its fetch status." to be very hard to parse, and I had to
go look at .git/FETCH_HEAD myself to understand what it was talking about.

It might help to instead describe `FETCH_HEAD` with an example,
especially since we already aren't giving a lot of details. 
Maybe something like this:

  Git has 2 special pseudorefs: `MERGE_HEAD` and `FETCH_HEAD`.
  Unlike references (which can only contain an object ID or the name of
  another reference), these have their own format:
  
  - `FETCH_HEAD` has a list of entries like this:
    `d4c5f27105ee2e44366d718dbc5db95bbe99c714 not-for-merge branch 'example' of https://example.com/x/y`
    with details about what was fetched by linkgit:git-fetch[1].
  - `MERGE_HEAD` has a list of commit IDs
  
  These are stored as files in the `.git` directory. You can pass a pseudoref
  to `git show`, `git log`, etc, and it will use the first ID in the list. 
  Pseudorefs can't be written by git-update-ref(1) or listed by
  git-for-each-ref(1).
Thread (45 messages) 45 messages, 4 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help