Subject: Re: customizing "cherry picked from commit abcd" comment

From: Junio C Hamano <[email-masked]>
Date: Tue, 30 Sep 2025 08:39:29 -0700

Oswald Buddenhagen <[email-masked]> writes:

> i sometimes customize this pseudo-footer as well, but it's usually
> things like "(partially cherry-picked ...)" or "(... from
> <repo>/<sha1>)", etc.

That does sound a sensible thing to do, assuming that the original
commit is public.  See below for a backstory why it is only a commit
object name and nothing else.

> your particular use case would imo be better addressed by implementing
> bi-directional linking between picked commits via a standardized
> git-notes namespace.

A nice property of notes is that they can be added after the fact
and can be mde bidirectional, so in a workflow allows adopting this
great suggestion, it is a very sensible thing to do.

> the pseudo-trailer is really just a hack in the first place, and
> afaict that status quo results from an ideological commitment against
> cherry-picks during the early history of git. but it's really kinda
> silly that subversion and perforce have better tracking of
> cherry-picks to this date, even when it's their only way to do merges.

I do not know what "an ideological commitment" refers to in this
context, but if I recall correctly, the reason why I originally
added the "cherry picked from" message in 48313592 (Redo "revert"
using three-way merge machinery., 2005-08-27) was because of
end-user requests, and given that the linux-kernel was pretty much
the only large customer back then, I suspect it came from there.

The intention was for the original commit to be also be public and
in the same project (e.g., you cherry-pick a commit from the main
branch developing towards the next great version, down to a
maintenance branch for the previous release), which made the commit
object name alone an sufficient identifier (also, this way predated
the invention of "git show -s --format=reference", so it is really
a dry hexadecimal object name and nothing else).

Initially, the feature to add the message was enabled by default.
Without passing an option, you always got the message in the
cherry-picked result.

Later, it was found that people ended up many commits with "cherry
picked from" messages that refer to commit objects that are not
available anywhere, because they cherry-pick across their private
branches while developing their patches, and the practice started
littering the public commits with these "useless" (because they do
not point at any commits that are part of anybody's official
history) references to the original commits they were cherry-picked
from.  And this made us turn the feature off by default, adding the
message only when the user explicitly asks to do so.