public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Florian Best <best@univention.de>, phillip.wood@dunelm.org.uk
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: cherry-pick: add --show-current-patch
Date: Mon, 16 Mar 2026 11:03:18 +0000	[thread overview]
Message-ID: <82a8a222-b18a-405f-9a9c-92c6e0c05591@gmail.com> (raw)
In-Reply-To: <f2bf231a-2b18-4f1c-9cbc-2b94f669839f@univention.de>

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
>>>
>>
> 


  parent reply	other threads:[~2026-03-16 11:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 18:30 cherry-pick: add --show-current-patch Florian Best
2026-03-11 19:30 ` Phillip Wood
     [not found]   ` <f2bf231a-2b18-4f1c-9cbc-2b94f669839f@univention.de>
2026-03-16 11:03     ` Phillip Wood [this message]
2026-03-17 22:55       ` Florian Best

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=82a8a222-b18a-405f-9a9c-92c6e0c05591@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=best@univention.de \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /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