While executing the merge
command, Git will perform the following steps:
Identify both the merge candidates from the
heads
directory based on specified parameters.Find the common ancestor of both heads and load all their objects in memory.
Perform a diff (difference) between the common ancestor and head one.
Apply the diff with head two.
If there are changes in common areas across heads, indicate the conflict with markers and inform the user about it (expecting the user to solve the conflict, add the changes, and make a commit).
If there are no conflicts, merge those contents, and make a merge commit mentioning metadata stating this.