All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Jeff King <peff@peff.net>
Cc: "Robert P. J. Day" <rpjday@crashcourse.ca>,
	Git Mailing list <git@vger.kernel.org>
Subject: Re: how to most effectively cherry pick by selective patch hunk?
Date: Tue, 09 Feb 2021 18:12:48 +0100	[thread overview]
Message-ID: <87im712mi7.fsf@igel.home> (raw)
In-Reply-To: <YCK6w/VbfUtM68Ad@coredump.intra.peff.net> (Jeff King's message of "Tue, 9 Feb 2021 11:39:31 -0500")

On Feb 09 2021, Jeff King wrote:

> Of course that involves a change to Git, and you were looking for
> something you could do with existing versions. :) You can emulate it by
> making the commit's parent equivalent to your current state. I.e.:
>
>   git checkout --detach ;# detached HEAD for temporary commit
>   git cherry-pick $commit ;# maybe deal with conflicts
>   commit=$(git rev-parse --verify HEAD) ;# remember the temp commit
>   git checkout - ;# back to your branch
>   git checkout -p $commit

Alternatively, you could cherry-pick normally, then use
 git checkout -p HEAD^
to remove what you don't want.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  parent reply	other threads:[~2021-02-09 17:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 13:58 how to most effectively cherry pick by selective patch hunk? Robert P. J. Day
2021-02-09 16:39 ` Jeff King
2021-02-09 16:58   ` Robert P. J. Day
2021-02-09 17:12   ` Andreas Schwab [this message]
2021-02-11  0:54     ` Elijah Newren

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=87im712mi7.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=rpjday@crashcourse.ca \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.