git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Julia Evans <julia@jvns.ca>
Date
Nov 2, 2026, 21:00 UTC
Message-ID
<f194e2af-cffc-4867-9069-7070c86785da@app.fastmail.com>
In-Reply-To
<CAHWeT-ZdZ0o=_rPWFPcXqCyc-WV=fzmKVRVx2LetfQzgYkKO0w@mail.gmail.com>
On Mon, Nov 2, 2026, at 2:47 PM, Andy Koppe wrote:
Show 53 quoted lines
> On Mon, 2 Nov 2026 at 18:20, Julia Evans wrote:
>> On Sun, Nov 1, 2026, at 6:03 PM, Andy Koppe wrote:
>
>> >     ++[[root-refs]]
>> >     ++root refs::
>> >     ++    Git may also create references other than `HEAD` at the root
>> > of the
>> >     ++    hierarchy, for example `ORIG_HEAD` or `REBASE_HEAD`.
>> >     ++
>> >     ++[[pseudorefs]]
>> >     ++pseudorefs::
>> >     ++    linkgit:git-fetch[1] and linkgit:git-merge[1] create the
>> > so-called
>> >     ++    pseudorefs `FETCH_HEAD` and `MERGE_HEAD`. They are not
>> > references as
>> >     ++    such, as they are not stored in the same way, but they can
>> > nevertheless
>>
>> When I look at my .git directory during a merge conflict, I see these
>> files:
>>
>> $ ls .git | grep HEAD
>> FETCH_HEAD
>> HEAD
>> MERGE_HEAD
>> ORIG_HEAD
>>
>> From the above, it sounds like ORIG_HEAD is a "root ref" and
>> MERGE_HEAD is a "pseudoref", but naively it does look like
>> they're stored in the same way. What's the difference?
>
> Good question. The differences certainly aren't obvious, and they
> barely matter to users.
>
> Root refs:
> - Can be stored in reftables instead of files in .git.
> - Contain either a single hash or a single symbolic ref such as 'ref:
> refs/heads/main'.
> - Can be modified with 'git update-ref' (generally a bad idea for
> built-in root refs) and listed with 'git for-each-ref' and similar
> commands.
>
> Pseudorefs:
> - Are always stored as files in .git.
> - May contain multiple hashes, and in the case of FETCH_HEAD, carry
> additional information about where each hash came from.
> - Are only modified by the commands they serve (i.e. fetch, merge and
> pull) and can't be listed.
>
> The big thing they have in common, apart from the *_HEAD names, is
> that you can pass both types to commands such as 'git log', 'git diff'
> or 'git checkout' to refer to a commit or tree, just like any ref
> under refs/.

That’s very helpful. I think it would make sense to include “may contain multiple hashes” at least, that on its own makes it very clear what the difference is.

My impression is that FETCH_HEAD specifically is a relatively popular pseudoref and folks would be interested to know that it can contain multiple hashes.

If a pseudoref contains multiple hashes and you pass it to a command, will the command use the first hash?

Also are FETCH_HEAD and MERGE_HEAD the only pseudorefs?

Previous: Andy KoppeNext: Andy Koppe
Message 22 of 34 in “root refs vs pseudorefs”
  1. 0/5 root refs vs pseudorefsAndy Koppe, Oct 22, 2026
  2. 1/5 doc: glossary: add root ref and clarify pseudorefsAndy Koppe, Oct 22, 2026
  3. Junio C HamanoOct 22, 2026
  4. Patrick SteinhardtOct 23, 2026
  5. Andy KoppeNov 1, 2026
  6. 2/5 doc: glossary: update per-worktree refsAndy Koppe, Oct 22, 2026
  7. Patrick SteinhardtOct 23, 2026
  8. Andy KoppeNov 1, 2026
  9. 3/5 doc: stop calling root refs pseudorefsAndy Koppe, Oct 22, 2026
  10. Patrick SteinhardtOct 23, 2026
  11. Andy KoppeNov 1, 2026
  12. 4/5 refs: stop calling root refs pseudorefsAndy Koppe, Oct 22, 2026
  13. Patrick SteinhardtOct 23, 2026
  14. Andy KoppeNov 1, 2026
  15. 5/5 t: stop calling root refs pseudorefsAndy Koppe, Oct 22, 2026
  16. Junio C HamanoOct 22, 2026
  17. Julia EvansOct 23, 2026
  18. Andy KoppeNov 1, 2026
  19. 0/5 root refs vs pseudorefsAndy Koppe, Nov 1, 2026
  20. Julia EvansNov 2, 2026
  21. Andy KoppeNov 2, 2026
  22. Julia EvansNov 2, 2026
  23. Andy KoppeNov 2, 2026
  24. Julia EvansNov 3, 2026
  25. Junio C HamanoNov 2, 2026
  26. 1/5 doc: glossary: add root ref and clarify pseudorefsAndy Koppe, Nov 1, 2026
  27. Patrick SteinhardtNov 3, 2026
  28. Junio C HamanoNov 3, 2026
  29. 2/5 doc: glossary: update per-worktree refsAndy Koppe, Nov 1, 2026
  30. Patrick SteinhardtNov 3, 2026
  31. 3/5 doc: stop calling root refs pseudorefsAndy Koppe, Nov 1, 2026
  32. Patrick SteinhardtNov 3, 2026
  33. 4/5 refs: stop calling root refs pseudorefsAndy Koppe, Nov 1, 2026
  34. 5/5 t: stop calling root refs pseudorefsAndy Koppe, Nov 1, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.