git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tao Klerks <tao@klerks.biz>
To: git <git@vger.kernel.org>
Cc: Elijah Newren <newren@gmail.com>
Subject: Cherry-Pick without affecting working tree / index?
Date: Thu, 2 Jun 2022 19:08:30 +0200	[thread overview]
Message-ID: <CAPMMpoj8CyhB=g0=HD2Y2w6+mkGVRsgoq6zsb5XCTt95uDELog@mail.gmail.com> (raw)

Hi folks,

I'm wondering whether it's possible to perform a (non-conflicting)
cherry pick without impacting the working tree (or index).

I understand Elijah Newren has been working on git-merge-tree changes
that would allow for simulating (and even saving) merge commits
without affecting the index or working tree, and I could imagine
that's a piece of how such a thing could/should work, but I'm not
terribly clear on the relationship between merges and cherry-picks.

It *seems* as though I could enact something functionally equivalent
to a cherry-pick by first creating a (temporary) "--ours" merge commit
on the target branch, pretending to have merged the parent commit of
the cherry-pickable one, and then merging the cherry-pick commit
itself on top of that. The resulting tree could be used as the basis
for a final commit on top of the original tip of the target branch, if
that merge were clean, and otherwise fail saying "there are conflicts,
go do things properly in a working tree pls".

I'm not sure whether this is the right way to conceive of
cherry-picking, however, or whether it makes more sense to conceive of
it as a single-commit rebase. Is there a relationship between
git-merge-tree and rebases? Is there an aspiration to develop "server
side rebase" also at some stage?

Thanks for any help understanding how cherry-picks conceptually "work".

Thanks,
Tao

             reply	other threads:[~2022-06-02 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 17:08 Tao Klerks [this message]
2022-06-02 23:52 ` Cherry-Pick without affecting working tree / index? Elijah Newren
2022-06-03  7:46   ` Tao Klerks

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='CAPMMpoj8CyhB=g0=HD2Y2w6+mkGVRsgoq6zsb5XCTt95uDELog@mail.gmail.com' \
    --to=tao@klerks.biz \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.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;
as well as URLs for NNTP newsgroup(s).