mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Atharva Raykar <>
Subject: Re: Logical bug during MERGE or REBASE
Date: Sat, 3 Jul 2021 13:27:51 +0530	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 02-Jul-2021, at 21:55, wrote:
> Hello.
> I got a strange result in the process of "merge" and/or "rebase".
> I'm not a git professional, so maybe this is not a bug, but a feature.
> But as for me, it would be logical to consider the construction inside {}
> as something whole, and not just put all the changes into one heap with
> notification what all OK, no conflicts.
> All the details are inside the git-bugreport-2021-07-02-1737.txt.
> I hope this log will be useful. Feel free to write me for extra details.  
> Best regards,
> Skott<git-bugreport-2021-07-02-1737.txt>

Let's look at the diffs (I have annotated this with arrows):

$ # common ancestor, ie, the first commit
$ initial=$(git merge-base master dev)

$ git diff $initial master

diff --git a/program.cs b/program.cs
index 8bc1a4d..93f872f 100644
--- a/program.cs
+++ b/program.cs
@@ -1,4 +1,6 @@
+ Console.Writeline("2");
+ Console.Readline();
  Console.Readline();     <--- X

$ git diff $initial dev

diff --git a/program.cs b/program.cs
index 8bc1a4d..eb91c97 100644
--- a/program.cs
+++ b/program.cs
@@ -1,4 +1,6 @@
  Console.Readline();     <--- X
+ Console.Readline();
+ Console.Readline();

As you can tell, on the master branch, Git sees the changes as
"lines were added above the line labeled X",
and on the dev branch, Git sees the changes as
"lines were added below the line labeled X".

Thus when a 3-way merge is performed, it sees no conflicting changes.
Adding lines above X does not conflict with adding lines below X.

I do agree the result does look surprising at first. If in the dev
branch, git had assumed the "Readline()s" to be added in between,
rather than at the bottom, you would have ended up with a conflict,
but that did not happen.

Atharva Raykar
ಅಥರ್ವ ರಾಯ್ಕರ್
अथर्व रायकर

  reply	other threads:[~2021-07-03  7:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 16:25 Logical bug during MERGE or REBASE skottkuk
2021-07-03  7:57 ` Atharva Raykar [this message]
2021-07-04  6:12   ` Bagas Sanjaya
2021-07-04  6:30     ` Atharva Raykar
2021-07-03  9:07 ` martin
2021-07-03 11:03 ` Ævar Arnfjörð Bjarmason

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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 read-only IMAP folder(s) and NNTP newsgroup(s).