How to view resolved conflicts in a merge?

Thiago Macieira thiago at kde.org
Wed Aug 17 10:17:04 BST 2011


On Tuesday, 16 de August de 2011 22:09:21 Stephen Kelly wrote:
> I've just locally merged KDE/4.7 into frameworks. Before I push I want
> to review the conflicts and their resolutions, and I expect other
> developers would want to do the same.
> 
> The merge showed that some commits in 4.7 have not made it into
> frameworks. We really should merge in that direction, not cherry-pick
> as everyone is currently doing.
> 
> I couldn't make git show me the conflicts. I tried git show, which
> surprises me as it shows a 3 way diff of a single file which was
> apparently not in conflict (full output attached). I also tried
> several variations of git diff frameworks^...origin/KDE/4.7.
> 
> How can I see the conflicts resolved in a merge? Do I just see no
> conlicts because I chose the frameworks branch in every hunk (which
> actually I don't think I did)?

You can't show the merge conflicts perfectly post-commit.

When you ask Git to show a diff of a merge commit, it will show a 3-way diff for 
files that differ from both parents. If you have a file which is exactly the same 
in one of the parents, it won't show anything.

As you can see from the diff header, that's the case:

diff --cc tier1/libkarchive/autotests/karchivetest.cpp
index 011477e,0000000..6ad5a8f

The two numbers before the .. indicate the SHA-1 of the file in each parent. 
The sequence of zeroes means the file wasn't present in one of them. But as you 
can see, the file in the merged commit is different from the other parent. 
That's why you see this file in a 3-way diff (the lines changed are 647-677 in 
your attachment).

The reason why this behaviour is that the diffing algorithm is not the same as 
the merging algorithm. The latter is much more expensive -- not to mention 
that there are several. If you want us to review your conflict fixes, please 
send the output of git diff / git diff --cached before you commit the merge. And 
it still won't show anything for fixes that are done by selecting one of the 
parents.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110817/fcee6bfa/attachment.sig>


More information about the kde-core-devel mailing list