How does 'git merge' work in details?

后端 未结 5 1474
夕颜
夕颜 2020-11-28 02:45

I want to know an exact algorithm (or near that) behind \'git merge\'. The answers at least to these sub-questions will be helpful:

  • How does git detect the con
5条回答
  •  春和景丽
    2020-11-28 03:24

    How does git detect the context of a particular non-conflicting change?
    How does git find out that there is a conflict in these exact lines?

    If the same line has changed on both side of the merge, it's a conflict; if they haven't, the change from one side (if existent) is accepted.

    Which things does git auto-merge?

    Changes that do not conflict (see above)

    How does git perform when there are multiple common bases for merging branches?

    By the definition of a Git merge-base, there is only ever one (the latest common ancestor).

    What happens when I merge multiple branches at once?

    That depends on the merge strategy (only the octopus and the ours/theirs strategies support merging more than two branches).

    What is a difference between merge strategies?

    This is explained in the git merge manpage.

提交回复
热议问题