Text 3-Way Merge

Merge a base file with two diverged edits — resolve conflicts visually

Ad placeholder (leaderboard)

Combine two independently edited versions of a file using their common ancestor as a reference — the same 3-way merge Git performs when joining branches. Changes made on only one side are applied automatically; regions both sides changed differently are flagged as conflicts with Git-style markers. Everything runs locally in your browser.

How it works

A naive 2-way diff cannot tell whether a difference means “A added a line” or “B deleted a line”. A 3-way merge resolves this by using the base (common ancestor):

  1. Diff base → A and base → B, line by line, using a longest-common-subsequence algorithm.
  2. Walk both diffs in lockstep over the base lines, classifying each region:
    • unchanged in both → keep the base text
    • changed in A only → take A
    • changed in B only → take B
    • changed in both, identically → take the shared result (no conflict)
    • changed in both, differently → emit a conflict

Conflicts are written with the familiar markers:

<<<<<<< A (mine)
A's version of the region
=======
B's version of the region
>>>>>>> B (theirs)

To resolve, edit the output to keep the side you want and delete the three marker lines.

Example

Base has the line port = 8080. Version A changes it to port = 9090; version B leaves it but adds debug = true below. These edits touch different lines, so the merge applies both with no conflict. If B had instead changed the same line to port = 7070, the region would conflict and be marked for you to resolve.

Tips

  • The cleaner your base, the fewer false conflicts: start from the exact version both edits diverged from.
  • Identical edits on both sides never conflict — the tool detects matching changes and keeps one copy.
  • After resolving, search the output for <<<<<<< to confirm no conflict markers remain before you copy.
Ad placeholder (rectangle)