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

Re: git notes and git-commit

From
Johan Herland <johan@herland.net>
Date
Dec 10, 2010, 14:13 UTC
Message-ID
<201012101513.43890.johan@herland.net>
In-Reply-To
<AANLkTi=q1F7WEgH+dLKTHOKhsNVuhU=OeyJ2AsP7oW2G@mail.gmail.com>
On Friday 10 December 2010, Nguyen Thai Ngoc Duy wrote:
Show 10 quoted lines
> Hi,
>
> I have never used git-notes before, just have had a quick look over
> git-notes.txt so this may have already been discussed.
>
> Isn't it more convenient to write/update notes when editing commit
> message? Jakub mentioned of "---" in the archive elsewhere. There's
> notes.rewriteRef for commit --amend. But if I amend a commit, I might
> as well change my notes. rewriteRef would not work with "git commit
> -c" either.

It seems your notes data is very much tied to your commit messages. If your notes needs editing every time you edit the commit message, I have to ask why you simply don't fold the notes into the commit message.

The same goes for rewriteRef vs. "git commit -c". If the notes should follow the commit message around, I have to ask why the notes are separate from the commit message in the first place.

That said, there might well be good use cases for this (e.g. using notes to store data types - e.g. binary data - that cannot be part of the commit message), so I will not advise against implementing this, but if you do, please also consider that there are notes use cases where the notes are tied to the actual contents of the commit, and not the commit message (e.g. notes-cache).

> Another (probably silly) thing. Can I temporarily attach notes to
> HEAD? I could add up notes while working, the notes show up when I
> edit for commit message. I could make revise the notes a bit and
> commit. Then the notes are attached to a commit.

Currently, this does not exist. However, a co-worker of mine suggested a feature recently that would benefit from what you describe above:

<digression> When cherry-picking, instead of using -x to store "(cherry picked from commit 1234567...)" in the commit message, it would be nice to use (e.g.) -X to store that message in a note. Storing these annotations in notes instead of in the commit message allows us to clean them up (i.e. removing references to now-unreachable commits) at a later date, without rewriting history.

However, in order for this to work together with "cherry-pick --no-commit", we need somewhere to store the note until the subsequent 'git commit' (i.e. something similar to .git/MERGE_MSG, but for notes). </digression>

Implementing something for notes analogous to .git/MERGE_MSG for commit messages would indeed be interesting. AFAICS, that also solves your request for editing notes for commits-in-progress.

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 2 of 4 in “git notes and git-commit”
  1. Nguyen Thai Ngoc DuyDec 10, 2010
  2. Johan HerlandDec 10, 2010
  3. Nguyen Thai Ngoc DuyDec 10, 2010
  4. Jonathan NiederDec 10, 2010

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.