How does ‘git merge’ work in details?
You might be best off looking for a description of a 3-way merge algorithm. A high-level description would go something like this: Find a suitable merge base B – a version of the file that is an ancestor of both of the new versions (X and Y), and usually the most recent such base (although … Read more