Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show conflict diff part of a merge

I need to present to the team what changes I've made during conflict resolution of a merge.

I know this is kind of hard, but I certainly believe it is possible somehow. I've tried already git show -m and git show -c.

like image 439
brauliobo Avatar asked May 15 '13 19:05

brauliobo


People also ask

How do you view merge conflicts?

To see the beginning of the merge conflict in your file, search the file for the conflict marker <<<<<<< . When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD .

What happens if you get a conflict during a merge?

Merge conflicts happen when you merge branches that have competing commits, and Git needs your help to decide which changes to incorporate in the final merge. Git can often resolve differences between branches and merge them automatically.


2 Answers

Look at the hash (or tag) of the merge commit (the commit that has multiple parents) and do:

git diff hash hash^1 hash^2

It will output a 3 way-diff of the changes.

hash^ (or hash^1) references the first parent commit of hash
hash^2 references the second parent commit of hash

like image 54
KurzedMetal Avatar answered Sep 23 '22 14:09

KurzedMetal


If you use the standard gitk tool, and click on a merge commit, the lower left pane shows the conflict resolutions.

like image 33
Klas Mellbourn Avatar answered Sep 23 '22 14:09

Klas Mellbourn