# "Temporary merge branch 2" Conflicts

4 messages from 2012-08-17 to 2012-08-20. Participants: Stephen Bash, Junio C Hamano.
Thread: https://gitlist.dev/t/31269

## Stephen Bash, 2012-08-17 13:48

Subject: "Temporary merge branch 2" Conflicts
Message-ID: <1972858401.161319.1345211324976.JavaMail.root@genarts.com>
URL: https://gitlist.dev/e/1972858401.161319.1345211324976.JavaMail.root%40genarts.com
In-Reply-To: <73388252.160741.1345208957127.JavaMail.root@genarts.com>

```
Hi all-

Given this branch history:

 ---------M------M---M-------> dev
     \   /      /   /
      --------------           v1-maint
            \   \   \
             ----M---M-------> v1.5-maint

I am attempting to merge v1.5-maint into dev.  There are some expected conflicts, but when I start mergetool (kdiff3) there are also a lot of conflict markers in the base that look like this

<<<<<<< Temporary merge branch 1
    ... code here ...
=======
    ... more code here ...
>>>>>>> Temporary merge branch 2

which confuse kdiff3.  Googling around I found a few mentions of these temporary merge branches, e.g. $gmane/157591, but I don't think we have any criss-cross merges.  Can anyone provide some advice?

Any suggestions are greatly appreciated!

Thanks,
Stephen

```

## Stephen Bash, 2012-08-17 20:56

Subject: Re: "Temporary merge branch 2" Conflicts
Message-ID: <732986549.167685.1345236990359.JavaMail.root@genarts.com>
URL: https://gitlist.dev/e/732986549.167685.1345236990359.JavaMail.root%40genarts.com
In-Reply-To: <1972858401.161319.1345211324976.JavaMail.root@genarts.com>

```
----- Original Message -----
> From: "Stephen Bash" <bash@genarts.com>
> Sent: Friday, August 17, 2012 9:48:45 AM
> Subject: "Temporary merge branch 2" Conflicts
> 
> Given this branch history:
> 
>  ---------M------M---M-------> dev
>      \   /      /   /
>       --------------           v1-maint
>             \   \   \
>              ----M---M-------> v1.5-maint
> 
> I am attempting to merge v1.5-maint into dev.

Turns out (not surprisingly) the graph is not that simple.  I have multiple (disjoint) merge bases:

  $ git merge-base --all dev v1.5-maint 
  ad9ed6c207fba9419b10a394e3721333d0d73e81
  5ff4cb0927188fb7246a0eff22d7ffed1a91fe2d
  $ git rev-list --ancestry-path 5ff4cb0..ad9ed6c
  $

A little investigation of 5ff4cb0 shows the branch structure looks more like:

       A-----C---------> v1-maint
      /      |\
 ----o       | \
      \      |  \
       B     |   \
       |\    |    \
 ------|-M---|-----M---> v1.5-maint
       |     |
 ------M-----M---------> dev

B is 5ff4cb0 and C is ad9ed6c (with several months and commits separating them).  A and B are tree-same (the only difference is the commit time and the log message).  Again, I'm attempting to merge v1.5-maint into dev.

> Googling around I found a few mentions of these temporary merge
> branches, e.g. $gmane/157591, but I don't think we have any
> criss-cross merges.

And now I'm convinced I do have some form of degenerate merge case.  I made several attempts to dig myself out of this hole, but failed.  

What is the recommended method for resolving this sort of merge?  kdiff3 obviously doesn't understand the situation.  Do the working tree files contain all the conflicts?  If so, I can just go through by hand and resolve the conflicts the old fashion way.

Separately, is mergetool passing the correct base file to the external tool if I'm seeing "Temporary merge branch" conflicts in it?  (I'm using git 1.7.11.4)

Thanks!
Stephen

```

## Junio C Hamano, 2012-08-17 21:10

Subject: Re: "Temporary merge branch 2" Conflicts
Message-ID: <7vfw7lteaw.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vfw7lteaw.fsf%40alter.siamese.dyndns.org
In-Reply-To: <732986549.167685.1345236990359.JavaMail.root@genarts.com>

```
Stephen Bash <bash@genarts.com> writes:

> What is the recommended method for resolving this sort of merge?
> kdiff3 obviously doesn't understand the situation.  Do the working
> tree files contain all the conflicts?  If so, I can just go
> through by hand and resolve the conflicts the old fashion way.

Yes.  External tools like kdiff3 may not understand the conflict in
the working tree, but the files in the working tree should have
resolved the naturally resolvable bits and only left the conflicted
bits conflicted.  Just resolve manually if you can, and then look at
what both branches wanted to do to the file ("git log -p --merge
$that_path" before you "git add" as the final sanity check would
work nicely) to make sure your resolution makes sense.

```

## Stephen Bash, 2012-08-20 13:21

Subject: Re: "Temporary merge branch 2" Conflicts
Message-ID: <1666100271.191032.1345468901838.JavaMail.root@genarts.com>
URL: https://gitlist.dev/e/1666100271.191032.1345468901838.JavaMail.root%40genarts.com
In-Reply-To: <7vfw7lteaw.fsf@alter.siamese.dyndns.org>

```
----- Original Message -----
> From: "Junio C Hamano" <gitster@pobox.com>
> Sent: Friday, August 17, 2012 5:10:47 PM
> Subject: Re: "Temporary merge branch 2" Conflicts
> 
> Stephen Bash <bash@genarts.com> writes:
> 
> > What is the recommended method for resolving this sort of merge?
> > kdiff3 obviously doesn't understand the situation.  Do the working
> > tree files contain all the conflicts?  If so, I can just go
> > through by hand and resolve the conflicts the old fashion way.
> 
> Yes.  External tools like kdiff3 may not understand the conflict in
> the working tree, but the files in the working tree should have
> resolved the naturally resolvable bits and only left the conflicted
> bits conflicted.  Just resolve manually if you can, and then look at
> what both branches wanted to do to the file ("git log -p --merge
> $that_path" before you "git add" as the final sanity check would
> work nicely) to make sure your resolution makes sense.

Thanks for the clarification Junio.  I'll take another swipe at it this week now that I know what I'm doing!

Stephen

```
