A three-way merge is the technique version-control systems use to combine work done in parallel. When two people start from the same file and each makes changes, a tool cannot tell what happened by looking at the two new versions alone. It needs a third reference point: the original version both people started from, called the common ancestor.
With three versions in hand, the original, your version, and their version, the system can reason about each change separately. If a line was edited on only one side, that edit is taken automatically. If both sides changed the same lines in different ways, the system flags a conflict and asks a person to decide. Most edits in practice touch different parts of a file, so the great majority merge cleanly without anyone intervening.
The Pro Git book describes this directly. When two branches have diverged, “Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two,” and records the result as a new merge commit that points back to both parents.
This is the machinery that makes large-scale collaboration possible. Without a common ancestor to compare against, every shared edit would risk silently overwriting someone else’s work. Three-way merging is what lets many people change the same code at the same time and still end up with one coherent result.