Git – diff3 Conflict Style – Temporary merge branch

What you have here (with the Temporary merge branch 1 and same with 2) is due to git’s “recursive merge” method:

            o->branch1 = "Temporary merge branch 1";
            o->branch2 = "Temporary merge branch 2";
            merge_recursive(o, merged_common_ancestors, iter->item,
                            NULL, &merged_common_ancestors);

(merge-recursive.c, around line 1940). Git will do a recursive merge when the commit graph has multiple candidates for the merge-base (see this blog post for more). To (over?)simplify a bit, git has done an internal, recursive merge that produced a merge conflict, then done the outer merge and hit another merge conflict. What you see is the outer merge conflict (ours vs theirs) with the inner conflict shown as the “base” version.

You may find that you get better results by choosing some other merge strategy, or using an alternative diff algorithm (the patience, minimal, and histogram algorithms vs the default myers). Or, you might want to disable diff3 style for a bit, so that you simply don’t see the inner merge.

Leave a Comment

tech