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

Re: git-notes, how do they work?

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
May 12, 2012, 11:01 UTC
Message-ID
<CACsJy8DRujbCc5Etod8eCoUW5+SxK-1qbJaAYw7gdvkO2SdSRw@mail.gmail.com>
In-Reply-To
<20120512104332.GN71676@acme.spoerlein.net>
On Sat, May 12, 2012 at 5:43 PM, Ulrich Spoerlein <uspoerlein@gmail.com> wrote:
> IIUC refs/notes/commits points to the latest note, which points to HEAD.
> However, there's no reference that points to the note pointing to
> HEAD^1, so how will it not be garbage collected?

No. refs/notes/commits points to a commit, whose tree contains all notes at the last time a note is changed. This commit has a parent commit that stores note snapshot of the previous change and so on..

refs/notes/commits is an ordinary ref, which is searched for reachability at gc time, so all notes (even replaced notes) cannot be deleted.

> How can it be pushed to a remote repository?

What I wrote about were my findings while I studied the notes code. I'm new to it too. And I believe there's no mechanism to transfer notes. Of course you can transfer resfs/notes/commits like any other refs, but the objects those notes are attached to might or might not exist at destination repo.

Show 5 quoted lines
> I understand that notes cannot point to older notes, as that would make
> removing/adding notes from/to older commits quite a hassle.
>
> So, what am I doing wrong here? How can I avoid notes from disappearing
> so that each and every one of it remains in the repo?
-- 
Duy
Previous: Ulrich SpoerleinNext: Ulrich Spoerlein
Message 2 of 4 in “git-notes, how do they work?”
  1. Ulrich SpoerleinMay 12, 2012
  2. Nguyen Thai Ngoc DuyMay 12, 2012
  3. Ulrich SpoerleinMay 12, 2012
  4. Angus HammondMay 12, 2012

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.