From: Junio C Hamano <gitster@pobox.com>
To: Aleksei Sviridkin <f@lex.la>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD
Date: Sat, 05 Sep 2026 09:29:51 -0700 [thread overview]
Message-ID: <xmqqik4j64qo.fsf@gitster.g> (raw)
In-Reply-To: <20260904124435.12865-1-f@lex.la> (Aleksei Sviridkin's message of "Fri, 4 Sep 2026 15:44:35 +0300")
Aleksei Sviridkin <f@lex.la> writes:
> diff --git a/Documentation/git-cherry-pick.adoc b/Documentation/git-cherry-pick.adoc
> index 42b41923d5..24a28d4e65 100644
> --- a/Documentation/git-cherry-pick.adoc
> +++ b/Documentation/git-cherry-pick.adoc
> @@ -25,7 +25,8 @@ happens:
> 1. The current branch and `HEAD` pointer stay at the last commit
> successfully made.
> 2. The `CHERRY_PICK_HEAD` ref is set to point at the commit that
> - introduced the change that is difficult to apply.
> + introduced the change that is difficult to apply, unless the
> + `--no-commit` option was given.
> 3. Paths in which the change applied cleanly are updated both
> in the index file and in your working tree.
> 4. For conflicting paths, the index file records up to three
> @@ -101,6 +102,11 @@ OPTIONS
> +
> This is useful when cherry-picking more than one commits'
> effect to your index in a row.
> ++
> +This option does not record `CHERRY_PICK_HEAD`, so a plain `git commit`
> +afterwards records you, not the original author, as the author. When a
> +single commit is picked this way, `git commit -c <commit>` keeps the
> +original authorship and log message.
While the added text does not say anything false, I am not sure if
the last sentence hits the mark.
Maybe we should hint that this is a deliberate design decision
behind the '--no-commit' option, perhaps in the description of that
option?
The reason 'cherry-pick --no-commit <commit>' does not record
<commit> in CHERRY_PICK_HEAD is that the command is meant to work as
a better version [*] of 'git show <commit> | git apply'. The point
of the operation is that you can continue to futz with the resulting
modified working tree to build your own work, and in that context,
you do not want the original authorship information.
So "When a single commit is ...", while not false, misses the point.
After continuing to futz with the resulting modified working tree to
build your own work, which may include picking (with the same
'--no-commit' option) many more commits or writing your own code, you
may still want to borrow a large part of the commit message from a
commit, and 'git commit -c <borrowed-commit>' would be the natural
thing to use.
But that advice belongs in the 'git commit' documentation, not the
'git cherry-pick' documentation.
Other than that, looking good.
Thanks.
[Footnote]
* "better" because unlike patch application, it can use 3-way merge
machinery to take the full file contents to wiggle the changes
from a different context into the code that is currently checked
out.
next prev parent reply other threads:[~2026-09-05 16:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 12:55 [PATCH 1/2] t3507: pin CHERRY_PICK_HEAD absence for a conflicting --no-commit Aleksei Sviridkin
2026-09-03 12:55 ` [PATCH 2/2] doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD Aleksei Sviridkin
2026-09-03 21:32 ` [PATCH 1/2] t3507: pin CHERRY_PICK_HEAD absence for a conflicting --no-commit Junio C Hamano
2026-09-03 21:45 ` Aleksei Sviridkin
2026-09-04 9:41 ` Patrick Steinhardt
2026-09-04 12:45 ` Aleksei Sviridkin
2026-09-04 13:53 ` Phillip Wood
2026-09-05 17:13 ` Aleksei Sviridkin
2026-09-04 16:17 ` Junio C Hamano
2026-09-05 17:13 ` Aleksei Sviridkin
2026-09-04 9:53 ` Phillip Wood
2026-09-04 16:20 ` Junio C Hamano
2026-09-04 9:57 ` Phillip Wood
2026-09-04 12:45 ` Aleksei Sviridkin
2026-09-04 13:57 ` Phillip Wood
2026-09-05 17:13 ` Aleksei Sviridkin
2026-09-04 12:44 ` [PATCH v2] doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD Aleksei Sviridkin
2026-09-05 16:29 ` Junio C Hamano [this message]
2026-09-05 17:13 ` [PATCH v3 0/2] cherry-pick: document that " Aleksei Sviridkin
2026-09-05 17:13 ` [PATCH v3 1/2] t3507: check no CHERRY_PICK_HEAD after conflicting --no-commit Aleksei Sviridkin
2026-09-05 17:13 ` [PATCH v3 2/2] doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD Aleksei Sviridkin
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=xmqqik4j64qo.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=f@lex.la \
--cc=git@vger.kernel.org \
/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