←back to thread

577 points Delgan | 1 comments | | HN request time: 0s | source
Show context
oftenwrong ◴[] No.44347165[source]
Another little-known feature is git trailers:

https://alchemists.io/articles/git_trailers

These are key-value structures data that can be included on a commit when it is created. These are used by some systems for attaching metadata. For example, Gerrit uses this for attaching its Change-Id.

replies(10): >>44347282 #>>44347522 #>>44347679 #>>44347997 #>>44348063 #>>44348331 #>>44348367 #>>44348438 #>>44351063 #>>44352844 #
_flux ◴[] No.44348438[source]
I used git notes for marking which of my commits in my branch I had run the unit tests for (and thus my script would skip those). This was useful when working with open source upstream where you want the massage the branch to perfection with git rebase -i.

It seems git trailers would now be the better place to put that information.

Regarding change ids: I wish git itself had those, as then also the tooling would understand them. Identifying commits by their commit messages is fragile, in particular when you may update those for an MR. While commit id truly identifies the commit in a unique way, it is not a useful identifier when the same changes could be moved on top of some other commit.

edit: Oh it looks like they are actually part of the commit, whereas notes aren't, so it wouldn't be a good replacement for my use.

replies(2): >>44348655 #>>44348913 #
1. masklinn ◴[] No.44348913{3}[source]
> Regarding change ids: I wish git itself had those, as then also the tooling would understand them. Identifying commits by their commit messages is fragile, in particular when you may update those for an MR. While commit id truly identifies the commit in a unique way, it is not a useful identifier when the same changes could be moved on top of some other commit.

Projects for which mutable changes are a unit of work are working on standardising that: https://lore.kernel.org/git/CAESOdVAspxUJKGAA58i0tvks4ZOfoGf...

They don't need git support, but it might eventually become first-class.