From: Jonathan Nieder <jrnieder@gmail.com>
To: Mike Stump <mikestump@comcast.net>
Cc: git@vger.kernel.org
Subject: Re: cherry picking and merge
Date: Fri, 1 Aug 2014 13:50:40 -0700 [thread overview]
Message-ID: <20140801205040.GT12427@google.com> (raw)
In-Reply-To: <20140801200201.GS12427@google.com>
Jonathan Nieder wrote:
> Do you mean that "git merge" should be aware of what changes you have
> already cherry-picked?
>
> It isn't, and that's deliberate
That said, when today's "git merge" fails to resolve conflicts, it's
easily possible that we could do better at resolving the merge by
walking through both sides and understanding what happened.
The detailed history lets you
i) Present conflicts in an easier to resolve way.
"Patch #1 which tries to do X conflicted with patch #2 which
tries to do Y; please reconcile them" can be less painful to
deal with than "Something in this pile conflicted with something
in that pile".
ii) Break a seeming conflict into pieces that can be automatically
resolved more easily.
X vs X'+Y may conflict where X' is a cherry-pick of X, if X and
Y touch the same code. Meanwhile if we're lucky then X vs X'
will not conflict because they make the same change, and Y can
apply on top.
iii) Handle cherry-picked changes in a *different* way. For example,
if patch X was applied on one side and applied and then reverted
on the other side, this could show up as a conflict. After all,
the two sides don't agree on whether patch X is a good change or
not.
These features have corresponding downsides:
i') (Speaking from experience of using git-imerge) Too many tiny
conflicts can sometimes be more painful to resolve than all the
conflicts at once. When X, Y, Z, and W had various conflicts,
how to reconcile X and Y alone or Z and W alone are academic
questions that don't actually need to be answered to produce
the merge result.
ii') This kind of clean, broken-down merge can produce a "clean"
but wrong result.
For example, if the following sequence of events occured:
1. Build fancy new feature X on "master".
2. Cherry-pick X to the bugfixes-only branch "maint".
Whoops.
3. Correct the mistake: revert X on "maint". Now "maint"
is bugfixes-only again!
4. Merge "maint" to "master".
Then a naive, 3-way merge will notice there is no change
on "maint" since it was last merged to master and the
merge will bring in no change (good).
And on the other hand a one-patch-at-a-time merge would
try to apply X (with no effect, since it's already applied)
and then try to apply the revert of X. The net effect would
be to revert X from "master" (bad)!
iii') See (ii').
git-imerge from https://github.com/mhagger/git-imerge can help with
(i) and (ii) but not (iii).
Hoping that clarifies,
Jonathan
next prev parent reply other threads:[~2014-08-01 20:50 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 0:58 cherry picking and merge Mike Stump
2014-08-01 2:43 ` brian m. carlson
2014-08-01 16:27 ` Jakub Narębski
2014-08-01 17:48 ` Mike Stump
2014-08-01 18:57 ` Philip Oakley
2014-08-01 22:10 ` Mike Stump
2014-08-02 10:39 ` Philip Oakley
2014-08-02 16:29 ` Philip Oakley
[not found] ` <CANQwDwc4YPdK+a0Oc-jWPTRyM5GiP-CMuRY1inxJY41GwUGBvQ@mail.gmail.com>
2014-08-01 19:01 ` Fwd: " Jakub Narębski
2014-08-01 22:24 ` Mike Stump
2014-08-02 11:44 ` Philip Oakley
2014-08-06 15:43 ` Jakub Narębski
2014-08-06 18:41 ` Mike Stump
2014-08-01 20:12 ` Sam Vilain
2014-08-01 23:06 ` Mike Stump
2014-08-01 23:40 ` Nico Williams
2014-08-02 0:18 ` Alex Davidson
2014-08-06 19:11 ` Mike Stump
2014-08-06 19:44 ` Rebase safely (Re: cherry picking and merge) Nico Williams
2014-08-06 20:13 ` Nico Williams
[not found] ` <A769B84E-42D1-44AC-B0A8-0F4E68AB71FB@comcast.net>
2014-08-07 5:11 ` Nico Williams
2014-08-08 17:34 ` Mike Stump
2014-08-08 18:27 ` Nico Williams
2014-08-08 16:23 ` Fwd: " Mike Stump
2014-08-01 16:56 ` cherry picking and merge Mike Stump
2014-08-21 17:36 ` Keller, Jacob E
2014-08-21 17:58 ` Keller, Jacob E
2014-08-01 19:22 ` Nico Williams
2014-08-01 22:13 ` Mike Stump
2014-08-01 22:19 ` Nico Williams
2014-08-01 20:02 ` Jonathan Nieder
2014-08-01 20:50 ` Jonathan Nieder [this message]
2014-08-01 20:55 ` Nico Williams
2014-08-01 21:44 ` Junio C Hamano
2014-08-01 22:00 ` Nico Williams
2014-08-01 22:09 ` Junio C Hamano
2014-08-06 15:58 ` Jakub Narębski
2014-08-06 16:26 ` Nico Williams
2014-08-06 23:16 ` Junio C Hamano
2014-08-06 23:20 ` Junio C Hamano
2014-08-01 23:47 ` Mike Stump
2014-08-01 22:35 ` Mike Stump
2014-08-01 22:42 ` Jonathan Nieder
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=20140801205040.GT12427@google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=mikestump@comcast.net \
/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).