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

Re: [Feature request] Give non-unique names to commits for grouping

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 11, 2020, 20:04 UTC
Message-ID
<xmqqeetyhd4x.fsf@gitster.c.googlers.com>
In-Reply-To
<CAGa6KtQ2dQWPWxbk2MH8QJxemM8QD_O=B3aYzsP5AH-sN-7PSw@mail.gmail.com>
Christos Pappas <chrispappas99@gmail.com> writes:
Show 9 quoted lines
> Thank you for your answers.
>
> From what I can deduce, both of your suggestions require that the
> commit messages(or notes) must have some special text for which we can
> search for, which is hacky and would be different on every repository.
>
> What I am suggesting is something like, labels on GitHub, hashtags on
> Social-Media, or Tags in News sites. It's a well known concept so it
> will be easy to understand and use.

By "hashtags", do you mean #hashtags, i.e. you must add some special text for which you can search for? That does sound just as hacky as any other embedded text in the messages of commit objects.

One large downside of embedding text (or #hashtags) in the message of a commit object is that you need to plan ahead and know what group the commit belongs to before you make it, but in general, it is unreasonable to expect perfect foresight. Often you do not know what group the commit belongs to (e.g. you may want to label the set of commits that broke the latest release for feature 'frotz' with hashtag "#broke-frotz", but most likely you didn't know you were breaking the feature when you were creating these commits). Adding these offending commit objects some comments in the form of notes objects can be done retroactively, and as long as the set of "tag-worthy" commits is minority among all commits, grepping for "#hashtag" in the notes to find the notes that contain the tags you wanted should be cheaper than "git log --grep" which must read all the commits in the history.

Another way may be "git notes --ref broke-frotz add X -m . X" (and similarly for Y and Z that also belong to "#broke-frotz" set of commits) to mark them with an almost empty note in refs/notes/broke-frotz hierarchy. Then "git notes --ref broke-frotz list" should be able to list these commits that have any notes in refs/notes/broke-frotz and there is no need for grepping. Of course you can make it richer by describing why each of X, Y, and Z are in the "broke-frotz" set when you give the notes text to them.

Previous: Christos Pappas
Message 7 of 7 in “[Feature request] Give non-unique names to commits for grouping”
  1. Christos PappasMar 10, 2020
  2. Konstantin TokarevMar 10, 2020
  3. Martin FickMar 11, 2020
  4. Christos PappasMar 11, 2020
  5. Martin FickMar 11, 2020
  6. Christos PappasMar 11, 2020
  7. Junio C HamanoMar 11, 2020

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.