From: Jeff King <peff@peff.net>
To: Francis Moreau <francis.moro@gmail.com>
Cc: Michael Gaber <Michael.Gaber@gmx.net>, git@vger.kernel.org
Subject: Re: question about a merge result
Date: Thu, 30 Apr 2009 11:42:40 -0400 [thread overview]
Message-ID: <20090430154240.GA27416@coredump.intra.peff.net> (raw)
In-Reply-To: <38b2ab8a0904300805j5ce19617mdda3254c37d06d38@mail.gmail.com>
On Thu, Apr 30, 2009 at 05:05:19PM +0200, Francis Moreau wrote:
> Well, obviously it's how git works since it's what I got.
Yes, I meant also "this is what it is supposed to do, by design".
> But the question was more about if the cortectness of the end result:
> should 'B' removed after the merge.
>
> IOW if someone works on its own branch remove B file and thought it
> was a bad idea and restore it whereas another person remove B file but
> miss the fact that it was a bad idea, does the merge should silently
> remove B file ?
Yes, it should be removed. And it has nothing to do with removal. Both
branches performed some action, but only one reverted it. Thus you still
have one branch wanting to make the change, and the other side leaving
it alone (in aggregate). So we want to take the changed side.
The only other thing that might make sense would be a conflict (because
both sides touched the same area and ended with different results). Git
doesn't try to find such a conflict because:
1. Fundamentally, git cares about endpoints, not changelogs. So by
design, you can arrive at the same tree state by many different
routes and the merge will still happen in the same way.
2. Finding such a conflict in the general case would be quite
expensive, because you have to track every bit of content changed
on one branch through every commit on the other branch, to see if
they ever overlap.
If you want the result of the merge to keep it, you should do one of:
- revert the removal in _both_ branches
- merge with "--no-commit", add it back in, and then commit. The
resulting commit will be a merge commit with the state you specify.
- merge the early part of one branch, with the removal, into the other
branch. Then "removed" becomes your basis for comparison, and then
when you re-merge, the branch that re-adds it will be the only
change.
-Peff
next prev parent reply other threads:[~2009-04-30 15:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-30 12:21 question about a merge result Francis Moreau
2009-04-30 12:34 ` Michael Gaber
2009-04-30 14:26 ` Jeff King
2009-04-30 15:05 ` Francis Moreau
2009-04-30 15:39 ` Björn Steinbrink
2009-04-30 15:42 ` Jeff King [this message]
2009-05-01 16:27 ` Daniel Barkalow
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=20090430154240.GA27416@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=Michael.Gaber@gmx.net \
--cc=francis.moro@gmail.com \
--cc=git@vger.kernel.org \
/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).