From: "Alex Riesen" <raa.lkml@gmail.com>
To: "Thomas Rast" <trast@student.ethz.ch>
Cc: skillzero@gmail.com, git@vger.kernel.org
Subject: Re: git merge and cherry-pick and duplicated commits?
Date: Wed, 14 Jan 2009 14:47:03 +0100 [thread overview]
Message-ID: <81b0412b0901140547u2fbd2feh89fc80f64b9bab81@mail.gmail.com> (raw)
In-Reply-To: <200901140941.17110.trast@student.ethz.ch>
2009/1/14 Thomas Rast <trast@student.ethz.ch>:
> skillzero@gmail.com wrote:
>> That's what I was somewhat disappointed by. Even though the result of
>> the commit had a different hash, I assumed git would keep some kind of
>> internal per-commit hash so it could tell later that two commits were
>> the same and not re-apply them.
>
> I think there's an important misunderstanding here: merging A into B
> does *not* have anything to do with commits, or history for that
> matter, beyond the differences from $(git merge-base A B) to A and
> B.[*]
>
> Along the same lines, nothing is ever re-applied during merging.
> git-merge just figures out that you made the same change on both
> sides, so it must have been a good change, so it must go into the end
> result. *How* you arrived at the same change---say, by
> cherry-picking, or by getting the same result in that region from
> otherwise different commits, or even from several commits---does *not*
> matter in any way.
Yes, merge only considers what bytes (aka contents of
trees-directories and blobs-files) do the branches to be merged
have, compares them (by comparing their hashes) and if there
are differences tries to mix them together according to the merge
rules described somewhere in Documentation.
So this all is really just about what the branches contain, not
how they got it. It is the conflict resolution algorithm which uses
the history to find the best possible source blob or tree which was
changed by conflicting branches so the "mix" can be prepared as
close as possible to what would we do if we went looking for the
pieces manually.
next prev parent reply other threads:[~2009-01-14 13:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-14 2:40 git merge and cherry-pick and duplicated commits? skillzero
2009-01-14 5:31 ` Brian Gernhardt
2009-01-14 6:21 ` skillzero
2009-01-14 7:34 ` Johannes Sixt
2009-01-14 8:08 ` skillzero
2009-01-14 8:34 ` Johannes Sixt
2009-01-14 18:33 ` skillzero
2009-01-14 19:40 ` Peter Baumann
2009-01-14 20:16 ` Junio C Hamano
2009-01-15 23:09 ` Markus Heidelberg
2009-01-14 8:38 ` Boaz Harrosh
2009-01-14 8:41 ` Thomas Rast
2009-01-14 13:47 ` Alex Riesen [this message]
2009-01-14 7:33 ` skillzero
2009-01-14 15:53 ` Sitaram Chamarty
2009-01-14 8:31 ` Nanako Shiraishi
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=81b0412b0901140547u2fbd2feh89fc80f64b9bab81@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=skillzero@gmail.com \
--cc=trast@student.ethz.ch \
/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).