Search code examples
gitmerge-conflict-resolutiondiff3

git: How to get "ours, theirs, original" for merge conflicts?


Git merge conflicts are shown like this usually:

<<<<<<< HEAD:file.txt
Code changed by A
=======
Code changed by B
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

However, I know it is possible (with some git config option) to also show the original code and not only the changes. Something like:

<<<<<<< HEAD:file.txt
Code changed by A
=======
Original code
=======
Code changed by B
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

However, I can't find the option anymore. Can anyone help me out?


Solution

  • Never mind, I just found the solution:

    git config --global merge.conflictstyle diff3
    

    It actually looks like this:

    <<<<<<< HEAD:file.txt
    Code changed by A
    ||||||| merged common ancestors
    Original code
    =======
    Code changed by B
    >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt