Volume XXII, number 280Wednesday, October 7, 2026Latest message 2 hours ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

cherry-pick: add --show-current-patch

4 messages between Mar 11, 2026 and Mar 17, 2026, from Florian Best, Phillip Wood.

Plain Markdown or JSON for tools and agents.

Florian BestMar 11, 2026, 18:30 UTC on lore
Hello,

When running `git cherry-pick` over a range of commits, the command may stop due to conflicts. At that point Git reports the conflict but does not provide an easy way to see which commit is currently being cherry-picked or what patch is being applied.

`git rebase` provides a helpful option for this situation:
`git rebase --show-current-patch`

This prints the patch of the commit that is currently being applied. I believe a similar feature would be useful for `git cherry-pick`.

Currently, when a conflict occurs during a range cherry-pick (e.g. `git cherry-pick A..B`), there is no straightforward command to show the patch of the commit being applied. While it is possible to inspect `.git/CHERRY_PICK_HEAD`and run something like:

`git show $(cat .git/CHERRY_PICK_HEAD)`
this is not very discoverable and requires manual steps.
Proposed feature
Add a command:
`git cherry-pick --show-current-patch`

which would display the patch of the commit currently being applied during an in-progress cherry-pick operation (similar to `git rebase --show-current-patch`).

Behavior could be:
  * If a cherry-pick is in progress, show the patch corresponding to 
`CHERRY_PICK_HEAD`.
  * If no cherry-pick is in progress, report an appropriate error.
Motivation
This would help users:
  * understand which commit caused the conflict
  * review the exact changes being applied
  * debug large range cherry-picks more easily
It would also provide feature parity with `git rebase`.

Best regards Florian

-- 
Florian Best
Open Source Software Engineer

Geschäftsführer: Peter H. Ganten, Stefan Gohmann
HRB 20755 Amtsgericht Bremen
Steuer-Nr.: 71-597-02876

Univention GmbH
Mary-Somerville-Str. 1
28359 Bremen
Germany / Deutschland

📞 Phone : +49 421 22232-0
🖶 Fax   : +49 421 22232-99
✉️best@univention.de
🌐https://www.univention.de / https://www.univention.com

Managing Directors: Peter H. Ganten, Stefan Gohmann
Local court: Amtsgericht Bremen
HRB 20755 / Steuer-Nr.: 71-597-02876

The information contained in this message is confidential or protected 
by law.
If you are not the intended recipient, please contact the sender and 
delete this message.
Any unauthorized copying of this message or unauthorized distribution of 
the information contained herein is prohibited.
Legally required information for business correspondence: Legal Information

Diese E-Mail enthält vertrauliche oder rechtlich geschützte Informationen.
Wenn Sie nicht der beabsichtigte Empfänger sind, informieren Sie bitte 
sofort den Absender und löschen Sie diese E-Mail. Das unbefugte Kopieren 
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen 
Informationen ist nicht gestattet.
Gesetzliche Pflichtangaben für Geschäftskorrespondenz: Datenschutzerklärung
Phillip WoodMar 11, 2026, 19:30 UTC in reply to Florian Best on lore

Re: cherry-pick: add --show-current-patch

Hi Florian
On 11/03/2026 18:30, Florian Best wrote:
Show 13 quoted lines
> Hello,
> 
> When running `git cherry-pick` over a range of commits, the command may 
> stop due to conflicts. At that point Git reports the conflict but does 
> not provide an easy way to see which commit is currently being cherry- 
> picked or what patch is being applied.
> 
> `git rebase` provides a helpful option for this situation:
> 
> `git rebase --show-current-patch`
> 
> This prints the patch of the commit that is currently being applied. I 
> believe a similar feature would be useful for `git cherry-pick`.

That option exists for rebase because it originally applied a series of patches rather than performing a 3-way merge like cherry-pick and so there was no other way of seeing which commit was being processed. With cherry-pick you can use

	git show CHERRY_PICK_HEAD

which allows you to add any of the options that you'd use when showing a commit. That is more flexible than a "--show-current-patch" option because you can restrict the diff to the path that you are interested in, or show a word-diff etc. When reverting you can use REVERT_HEAD and when rebasing you can use REBASE_HEAD to see the commit being picked. I did wonder if the documentation could be improved but for cherry-pick it mentions CHERRY_PICK_HEAD in the description section at the top of the page.

Thanks
Phillip
Show 40 quoted lines
> Currently, when a conflict occurs during a range cherry-pick (e.g. `git 
> cherry-pick A..B`), there is no straightforward command to show the 
> patch of the commit being applied. While it is possible to inspect 
> `.git/CHERRY_PICK_HEAD`and run something like:
> 
> `git show $(cat .git/CHERRY_PICK_HEAD)`
> 
> this is not very discoverable and requires manual steps.
> 
> 
> Proposed feature
> 
> Add a command:
> 
> `git cherry-pick --show-current-patch`
> 
> which would display the patch of the commit currently being applied 
> during an in-progress cherry-pick operation (similar to `git rebase -- 
> show-current-patch`).
> 
> Behavior could be:
> 
>   * If a cherry-pick is in progress, show the patch corresponding to 
> `CHERRY_PICK_HEAD`.
>   * If no cherry-pick is in progress, report an appropriate error.
> 
> 
> Motivation
> 
> This would help users:
> 
>   * understand which commit caused the conflict
>   * review the exact changes being applied
>   * debug large range cherry-picks more easily
> 
> It would also provide feature parity with `git rebase`.
> 
> Best regards
> Florian
> 
Phillip WoodMar 16, 2026, 11:03 UTC on lore

Re: cherry-pick: add --show-current-patch

Hi Florian
On 11/03/2026 19:42, Florian Best wrote:
Show 12 quoted lines
> Hi Phillip,
> 
> thank you!
> Your reasoning makes sense, and therefore --show-current-patch is 
> probably a bad idea.
> I simply oversaw that complex sentence in the --help/manpage:
> 
>  >          2. The CHERRY_PICK_HEAD ref is set to point at the commit 
> that introduced the change that is difficult to apply.
> 
> Maybe adding "git show CHERRY_PICK_HEAD" to the Examples section of the 
> manpage improves finding it.
That sounds reasonable, are you interested in contributing a patch?
Thanks
Phillip
Show 83 quoted lines
> Best regards
> Florian
> 
> Am 11.03.26 um 20:30 schrieb Phillip Wood:
>> Hi Florian
>>
>> On 11/03/2026 18:30, Florian Best wrote:
>>> Hello,
>>>
>>> When running `git cherry-pick` over a range of commits, the command 
>>> may stop due to conflicts. At that point Git reports the conflict but 
>>> does not provide an easy way to see which commit is currently being 
>>> cherry- picked or what patch is being applied.
>>>
>>> `git rebase` provides a helpful option for this situation:
>>>
>>> `git rebase --show-current-patch`
>>>
>>> This prints the patch of the commit that is currently being applied. 
>>> I believe a similar feature would be useful for `git cherry-pick`.
>>
>> That option exists for rebase because it originally applied a series 
>> of patches rather than performing a 3-way merge like cherry-pick and 
>> so there was no other way of seeing which commit was being processed. 
>> With cherry-pick you can use
>>
>>     git show CHERRY_PICK_HEAD
>>
>> which allows you to add any of the options that you'd use when showing 
>> a commit. That is more flexible than a "--show-current-patch" option 
>> because you can restrict the diff to the path that you are interested 
>> in, or show a word-diff etc. When reverting you can use REVERT_HEAD 
>> and when rebasing you can use REBASE_HEAD to see the commit being 
>> picked. I did wonder if the documentation could be improved but for 
>> cherry-pick it mentions CHERRY_PICK_HEAD in the description section at 
>> the top of the page.
>>
>> Thanks
>>
>> Phillip
>>
>>> Currently, when a conflict occurs during a range cherry-pick (e.g. 
>>> `git cherry-pick A..B`), there is no straightforward command to show 
>>> the patch of the commit being applied. While it is possible to 
>>> inspect `.git/CHERRY_PICK_HEAD`and run something like:
>>>
>>> `git show $(cat .git/CHERRY_PICK_HEAD)`
>>>
>>> this is not very discoverable and requires manual steps.
>>>
>>>
>>> Proposed feature
>>>
>>> Add a command:
>>>
>>> `git cherry-pick --show-current-patch`
>>>
>>> which would display the patch of the commit currently being applied 
>>> during an in-progress cherry-pick operation (similar to `git rebase 
>>> -- show-current-patch`).
>>>
>>> Behavior could be:
>>>
>>>   * If a cherry-pick is in progress, show the patch corresponding to 
>>> `CHERRY_PICK_HEAD`.
>>>   * If no cherry-pick is in progress, report an appropriate error.
>>>
>>>
>>> Motivation
>>>
>>> This would help users:
>>>
>>>   * understand which commit caused the conflict
>>>   * review the exact changes being applied
>>>   * debug large range cherry-picks more easily
>>>
>>> It would also provide feature parity with `git rebase`.
>>>
>>> Best regards
>>> Florian
>>>
>>
> 
Florian BestMar 17, 2026, 22:55 UTC in reply to Phillip Wood on lore

Re: cherry-pick: add --show-current-patch

Dear Phillip,

attached is a patch suggestion, also available as Github PR: https://github.com/git/git/pull/2243

Best regards Florian

Am 16.03.26 um 12:03 schrieb Phillip Wood:
Show 107 quoted lines
> Hi Florian
>
> On 11/03/2026 19:42, Florian Best wrote:
>> Hi Phillip,
>>
>> thank you!
>> Your reasoning makes sense, and therefore --show-current-patch is 
>> probably a bad idea.
>> I simply oversaw that complex sentence in the --help/manpage:
>>
>>  >          2. The CHERRY_PICK_HEAD ref is set to point at the commit 
>> that introduced the change that is difficult to apply.
>>
>> Maybe adding "git show CHERRY_PICK_HEAD" to the Examples section of 
>> the manpage improves finding it.
>
> That sounds reasonable, are you interested in contributing a patch?
>
> Thanks
>
> Phillip
>
>> Best regards
>> Florian
>>
>> Am 11.03.26 um 20:30 schrieb Phillip Wood:
>>> Hi Florian
>>>
>>> On 11/03/2026 18:30, Florian Best wrote:
>>>> Hello,
>>>>
>>>> When running `git cherry-pick` over a range of commits, the command 
>>>> may stop due to conflicts. At that point Git reports the conflict 
>>>> but does not provide an easy way to see which commit is currently 
>>>> being cherry- picked or what patch is being applied.
>>>>
>>>> `git rebase` provides a helpful option for this situation:
>>>>
>>>> `git rebase --show-current-patch`
>>>>
>>>> This prints the patch of the commit that is currently being 
>>>> applied. I believe a similar feature would be useful for `git 
>>>> cherry-pick`.
>>>
>>> That option exists for rebase because it originally applied a series 
>>> of patches rather than performing a 3-way merge like cherry-pick and 
>>> so there was no other way of seeing which commit was being 
>>> processed. With cherry-pick you can use
>>>
>>>     git show CHERRY_PICK_HEAD
>>>
>>> which allows you to add any of the options that you'd use when 
>>> showing a commit. That is more flexible than a 
>>> "--show-current-patch" option because you can restrict the diff to 
>>> the path that you are interested in, or show a word-diff etc. When 
>>> reverting you can use REVERT_HEAD and when rebasing you can use 
>>> REBASE_HEAD to see the commit being picked. I did wonder if the 
>>> documentation could be improved but for cherry-pick it mentions 
>>> CHERRY_PICK_HEAD in the description section at the top of the page.
>>>
>>> Thanks
>>>
>>> Phillip
>>>
>>>> Currently, when a conflict occurs during a range cherry-pick (e.g. 
>>>> `git cherry-pick A..B`), there is no straightforward command to 
>>>> show the patch of the commit being applied. While it is possible to 
>>>> inspect `.git/CHERRY_PICK_HEAD`and run something like:
>>>>
>>>> `git show $(cat .git/CHERRY_PICK_HEAD)`
>>>>
>>>> this is not very discoverable and requires manual steps.
>>>>
>>>>
>>>> Proposed feature
>>>>
>>>> Add a command:
>>>>
>>>> `git cherry-pick --show-current-patch`
>>>>
>>>> which would display the patch of the commit currently being applied 
>>>> during an in-progress cherry-pick operation (similar to `git rebase 
>>>> -- show-current-patch`).
>>>>
>>>> Behavior could be:
>>>>
>>>>   * If a cherry-pick is in progress, show the patch corresponding 
>>>> to `CHERRY_PICK_HEAD`.
>>>>   * If no cherry-pick is in progress, report an appropriate error.
>>>>
>>>>
>>>> Motivation
>>>>
>>>> This would help users:
>>>>
>>>>   * understand which commit caused the conflict
>>>>   * review the exact changes being applied
>>>>   * debug large range cherry-picks more easily
>>>>
>>>> It would also provide feature parity with `git rebase`.
>>>>
>>>> Best regards
>>>> Florian
>>>>
>>>
>>
>
-- 
Florian Best
Open Source Software Engineer

Geschäftsführer: Peter H. Ganten, Stefan Gohmann
HRB 20755 Amtsgericht Bremen
Steuer-Nr.: 71-597-02876

Univention GmbH
Mary-Somerville-Str. 1
28359 Bremen
Germany / Deutschland

📞 Phone : +49 421 22232-0
🖶 Fax   : +49 421 22232-99
✉️ best@univention.de
🌐 https://www.univention.de / https://www.univention.com

Managing Directors: Peter H. Ganten, Stefan Gohmann
Local court: Amtsgericht Bremen
HRB 20755 / Steuer-Nr.: 71-597-02876

The information contained in this message is confidential or protected by law.
If you are not the intended recipient, please contact the sender and delete this message.
Any unauthorized copying of this message or unauthorized distribution of the information contained herein is prohibited.
Legally required information for business correspondence: Legal Information

Diese E-Mail enthält vertrauliche oder rechtlich geschützte Informationen.
Wenn Sie nicht der beabsichtigte Empfänger sind, informieren Sie bitte sofort den Absender und löschen Sie diese E-Mail. Das unbefugte Kopieren dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen ist nicht gestattet.
Gesetzliche Pflichtangaben für Geschäftskorrespondenz: Datenschutzerklärung



From 8c9c2bd986c4e24c0f8715c5c0b2a97a4d6ad982 Mon Sep 17 00:00:00 2001
From: Florian Best <best@univention.de>
Date: Tue, 17 Mar 2026 23:49:44 +0100
Subject: [PATCH] docs(cherry-pick): document CHERRY_PICK_HEAD ref

Signed-off-by: Florian Best <best@univention.de>
---
 Documentation/git-cherry-pick.adoc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git Documentation/git-cherry-pick.adoc Documentation/git-cherry-pick.adoc
index 42b41923d5..21de8bbb0e 100644
--- Documentation/git-cherry-pick.adoc
+++ Documentation/git-cherry-pick.adoc
@@ -228,6 +228,12 @@ EXAMPLES
 	so the result can be inspected and made into a single new
 	commit if suitable.
 
+`git show CHERRY_PICK_HEAD`::
+
+	Show the commit currently being applied when a cherry-pick
+	stops due to conflicts. The `CHERRY_PICK_HEAD` reference
+	identifies this commit.
+
 The following sequence attempts to backport a patch, bails out because
 the code the patch applies to has changed too much, and then tries
 again, this time exercising more care about matching up context lines.
-- 
2.39.5

Back to recent threads