How does a three-way merge determine the merge base, and why is it needed?
Last updated
Git walks the commit graph to find the merge base: the lowest common ancestor of both tips (shown by
git merge-base). Multiple equal ancestors are merged into a virtual base.Comparing base, ours and theirs tells Git which side actually changed a region. A one-sided change wins automatically, and differing changes to the same hunk become a conflict.
A two-way diff of just the tips can't tell which side is authoritative, so every difference would conflict.