Three-Way Merge
Combining two lines of work by comparing both against their common ancestor.
A three-way merge combines two divergent versions by comparing each against their common ancestor — the merge base. Knowing the ancestor is what lets the algorithm distinguish "this side changed it" from "that side changed it", and to combine non-overlapping changes automatically.
The merge base is why comparisons must be taken against the ancestor rather than against the current tip of the other branch. Diffing a branch against the current main attributes every change made on main since the branch was cut to the branch itself. The three-dot form of a diff selects the merge base and is almost always what is wanted.
Two things merges cannot do.
They cannot detect semantic incompatibility. Non-overlapping changes are combined without complaint even when they contradict each other; see Semantic Conflict. Conflict absence is not agreement.
They cannot resolve genuine overlap, which is a Merge Conflict and requires a human decision.
There is also a duplication hazard: two branches that each added the same content in the same place can merge with no conflict markers and produce it twice, which a compiler catches and a reader might not.
See also11
Rebase
Replaying a branch's commits onto a new base, producing new commits with the same changes.
Version Control & Delivery19 connections
Merge Train
Validating changes against the state they will actually merge into, in order, rather than in isolation.
Version Control & Delivery14 connections
Stacked Pull Requests
A chain of dependent changes, each reviewed separately and merged in order.
Version Control & Delivery12 connections
Regression
A previously working behavior that a change has broken.
Method23 connections
Version Control
A system recording the history of a project's files, enabling branching, merging, and recovery.
Version Control & Delivery26 connections
Trunk-Based Development
Everyone integrating into one shared branch continuously, with short-lived feature branches.
Version Control & Delivery20 connections
Continuous Integration
Automatically building and testing every change, so integration problems surface immediately.
Version Control & Delivery38 connections
Git Object Model
Git stores every version of a project as a graph of immutable objects named by the hashes of their contents, blobs for files, trees for directories, and commits for snapshots, which makes history tamper-evident and identical content free to store twice.
Version Control & Delivery12 connections
Staging Area
The intermediate snapshot in Git between the working files and the next commit, which lets a developer choose exactly which changes go into each commit, down to individual lines.
Version Control & Delivery15 connections
Fast-Forward Merge
The two basic ways Git joins branches, by sliding a branch pointer forward or by recording a new commit with two parents, and how the choice shapes a project's history.
Version Control & Delivery14 connections
Feature Branch
A branch created to develop one change in isolation before merging it back, a workflow that keeps the main line stable but grows riskier the longer the branch lives, since its divergence from everyone else's work compounds.
Version Control & Delivery16 connections
Linked from15
- Branching ModelVersion Control & Delivery
The convention governing what branches exist, what they mean, and how work reaches production.
- Cherry-PickVersion Control & Delivery
Copying the change from one commit onto another branch as a new commit, the standard way to backport a fix without merging everything else that came with it.
- CommitVersion Control & Delivery
A recorded snapshot of a project with a message explaining it.
- Continuous IntegrationVersion Control & Delivery
Automatically building and testing every change, so integration problems surface immediately.
- DiffVersion Control & Delivery
The listing of changes between two versions of a file, the algorithms that compute it, and the unified format that code review, patches, and merges are built on.
- Fast-Forward MergeVersion Control & Delivery
The two basic ways Git joins branches, by sliding a branch pointer forward or by recording a new commit with two parents, and how the choice shapes a project's history.
- Feature BranchVersion Control & Delivery
A branch created to develop one change in isolation before merging it back, a workflow that keeps the main line stable but grows riskier the longer the branch lives, since its divergence from everyone else's work compounds.
- Git Object ModelVersion Control & Delivery
Git stores every version of a project as a graph of immutable objects named by the hashes of their contents, blobs for files, trees for directories, and commits for snapshots, which makes history tamper-evident and identical content free to store twice.
- Merge ConflictVersion Control & Delivery
Overlapping changes that a merge cannot combine automatically, requiring a decision.
- Merge TrainVersion Control & Delivery
Validating changes against the state they will actually merge into, in order, rather than in isolation.
- RebaseVersion Control & Delivery
Replaying a branch's commits onto a new base, producing new commits with the same changes.
- Semantic ConflictVersion Control & Delivery
Two changes that merge cleanly and are incompatible in meaning.
- Stacked Pull RequestsVersion Control & Delivery
A chain of dependent changes, each reviewed separately and merged in order.
- Trunk-Based DevelopmentVersion Control & Delivery
Everyone integrating into one shared branch continuously, with short-lived feature branches.
- Version ControlVersion Control & Delivery
A system recording the history of a project's files, enabling branching, merging, and recovery.