2

When I try to rebase one of my branches onto another, git is not able to merge and raises conflict. I can see the following in the conflicted file:

<<<<<<< HEAD
=======
  if (($mode == 'w')) {
    $mode = 'r';
    var_export($GLOBALS, true);
    //print("<pre>");
    //var_dump(array_keys($GLOBALS));
    //print("</pre>");
  }
>>>>>>> 7896670... Some initial changes that I carried over from other directory...

I am just wondering why git is not able to merge these two commits? It is a trivial merge, isn't it? One version contains nothing and another version contains something, so the merge is simple. What am I missing?

Yogeshwer Sharma
  • 3,647
  • 5
  • 25
  • 27
  • You said rebase and merge here, which are you doing? Can you post the command you issued to have this happen and when you say one contains nothing can you be specific, which one contains nothing? – Chris Nicola Aug 08 '11 at 04:48
  • @Chris Nicola: The command I gave was `git rebase -i origin/master` (I had a bunch of commits... I was picking the first one and squashing the rest). I got so confused in the process that I actually did all the merge manually without understanding why git was giving me these conflicts. I need to understand 3-way merge algorithm I guess! – Yogeshwer Sharma Aug 08 '11 at 20:04

1 Answers1

4

Check the common ancestor of them (the merge base) -- it should contains something else.

git diff `git merge-base HEAD 7896670` HEAD
J-16 SDiZ
  • 26,473
  • 4
  • 65
  • 84