Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Trevor Gross <tg@trevorgross.com>
Cc: git@vger.kernel.org,  Jeff King <peff@peff.net>,
	 Stefan Haller <lists@haller-berlin.de>,
	 Derrick Stolee <stolee@gmail.com>,
	 Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH] rebase -i: introduce `pick -x` to add "cherry picked from commit ..."
Date: Sun, 05 Jul 2026 13:52:38 -0700	[thread overview]
Message-ID: <xmqqechhcg6h.fsf@gitster.g> (raw)
In-Reply-To: <20260705140931.98262-2-tg@trevorgross.com> (Trevor Gross's message of "Sun, 5 Jul 2026 14:09:06 +0000")

There is another thing.

> Using `exec git cherry-pick ... -x` does work, ...

Does it really work?  I seem to recall there is a reason why "pick"
insn in the rebase todo list and "exec git cherry-pick" would not
work identically and the distinction is rather deliberate.

Rebase copies the notes attached to the original commits to the
corresponding rewritten commits.  This is because rebase is a way to
_move_ an existing (and hopefully not yet published) history on top
of some other base, with the full intention to destroy, abandon,
remove, and forget about the original history, and nobody will see
the original commits after the rebase is finished.  Copying notes,
therefore, is a sensible way to preserve the data, as these new
commits fully _replace_ the old ones.

On the other hand, cherry-pick is about _duplicating_ a parallel
history in a new context that is separate from the original, while
preserving the original history.  Since the expectation is that the
original history will be kept (and not rewritten---otherwise the
"cherry picked from ..." comment will totally be useless), and the
new commits are being created to live in their own new _context_,
notes are not carried over.

As can be seen in the mental model above, "rebase" by its nature
is what you do with the intention not to keep the original. From
that point of view, "pick -x" is a poor fit in the context, because
for the result from "cherry-pick -x" to be any useful, the original
commit you made the picked commit out of MUST be known to those who
learn the fact that this new commit was cherry-picked from that
other commit.  It goes directly opposite to what "rebase" does, in
that the point of rebase is to destroy "that other commit" and make
sure nobody will see it after rebase is done.

So...

  parent reply	other threads:[~2026-07-05 20:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 14:09 [PATCH] rebase -i: introduce `pick -x` to add "cherry picked from commit ..." Trevor Gross
2026-07-05 18:58 ` Junio C Hamano
2026-07-05 22:23   ` Matt Hunter
2026-07-05 20:52 ` Junio C Hamano [this message]
2026-07-06  0:24 ` Jeff King
2026-07-06 10:08   ` Phillip Wood
2026-07-06 20:24     ` Junio C Hamano
2026-07-07  4:27     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqechhcg6h.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=lists@haller-berlin.de \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=stolee@gmail.com \
    --cc=tg@trevorgross.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox