36

My git repo looks like this:

         _ branch_a
        /
master /
        \_ branch_b

Now I want to merge branch_b into branch_a, not either branch into master.

So, I did

git checkout branch_a
git merge branch_b

And git went and found a couple of conflicts.

When I do git mergetool using meld what I get on the console is

 {local}: modified file
 {remote}: modified file

and a window showing only LOCAL and REMOTE.

What I want to know is:

  1. Why isn't the shared base of what was in master shown?

  2. Between LOCAL and REMOTE, which one am I supposed to edit?

EMiller
  • 2,792
  • 4
  • 34
  • 55
  • 7
    If you want to merge A into B the correct commands are `git checkout branch_b git merge branch_a` – iberbeu Mar 06 '13 at 21:28
  • What version of git are you using? When I use meld as a mergetool it presents it as a three-way merge off of the common base. I have never seen it show just two files, so I have no idea which you're expected to modify. – qqx Mar 06 '13 at 21:42
  • Strange, that version should definitely be giving meld the common base version of the file along with the versions from the two branches. – qqx Mar 06 '13 at 22:15

1 Answers1

11

If you merge a branch A into a branch B the conflicts that you get come from the difference between both branches and not from the difference with master. executing git diff in A or B will give you however the diff with mastere since it is the ancestor

Normally the local branch should be the one you are merging into and the remote the one you want to merge. Anyway in your computer you will only have one copy of the file so just modify it

iberbeu
  • 15,295
  • 5
  • 27
  • 48
  • It's technically true that the `master` branch wouldn't be involved in that merge. But, the commit that master points to in that case would be since it is the common ancestor. – qqx Mar 06 '13 at 21:50
  • The diff of a branch (a or b) is taken from the comparisson with the ancestor (master in this case) that is true, but when you merge A into B the conflicts are given by those branches and not by master. That is what I meant. I edited my answer – iberbeu Mar 06 '13 at 21:58