How does a three-way merge work in Git?
Git compares three snapshots: the two branch tips and their common ancestor. Changes made on only one side are taken automatically; if both sides changed the same lines differently, Git reports a conflict.
Explain it simply
Two students edit copies of the same assignment. To combine them fairly you need the original too. If only Asha changed a paragraph, keep her version. If only Ravi changed it, keep his. If both rewrote the same sentence differently, a human must decide.
Git does exactly this with the merge base, the latest commit both branches share. Comparing each tip with the base tells it who changed what. Non-overlapping changes merge cleanly into a new commit with two parents. Overlapping ones produce conflict markers. A two-way comparison without the base could not tell 'one side changed it' from 'both sides disagree'.
Example
git merge-base main feature # prints the common ancestor hash
git merge feature # creates a merge commit with two parents
git log --oneline --graphWhat to say in the interview
"Git finds the merge base, the closest common ancestor, and diffs both branch tips against it. Changes on one side are applied automatically, and changes to the same region on both sides cause a conflict. The result is a merge commit with two parents."