What are the reasons and cases that cause git merge conflicts?

Viewed 7556
  1. What are

    • the necessary and sufficient conditions, and/or

    • all the cases or some common cases

    that can cause git merge report merge conflict?

    How does git merge determine whether a line or some lines contain merge conflict(s)?

  2. For example, I sometimes see cases like the following, where either Part 1 or Part 2 is empty in

    <<<<<<< HEAD
    (Part 1)
    =======
    (Part 2)
    >>>>>>> some-other-branch
    

    It looks unlikely to have a merge conflict to me. So what are some possible reasons that cases like that have merge conflicts?

  3. Comparing the merge conflicts reported by git merge and the differences reported by git diff, is it correct that

    • the differences reported by git diff might not necessarily be in the places of the merge conflicts reported by git merge, and

    • the merge conflicts reported by git merge might not necessarily be in the places of the differences reported by git diff?

Thanks.

1 Answers
Related