Search code examples
gitdiffgit-diff

What is the diff version git uses? diff2 or diff3?


Does anyone know which diff version is used by git?

This article for example explains in detail the diff algorithm for dummies but what is the actual algorithm which is used?

For general knowledge here are the specs for diff2 and diff3.

I know you can configure git to use diff2 or diff3

git config --global merge.conflictstyle diff3

Solution

  • I found the answer in the config documentation:
    git defaults is diff2

    merge.conflictStyle

    Specify the style in which conflicted hunks are written out to working tree files upon merge.

    The default is "merge", which shows a <<<<<<< conflict marker,
    changes made by one side, a ======= marker,
    changes made by the other side,
    and then a >>>>>>> marker. An alternate style,

    "diff3", adds a ||||||| marker and the original text before the ======= marker.