Kelly Mears

Merge Conflict

Overlapping changes that a merge cannot combine automatically, requiring a decision.

Version Control & Delivery2 min read211 words11 out · 14 in
also calledConflict resolution

A merge conflict arises when two lines of work modify the same region and the merge algorithm cannot determine the correct combination. Git marks the region with both versions and hands it to a person.

Resolving well is a design activity, not a text-editing one. The question is what the code should be given both intentions, which sometimes means neither side verbatim.

Several practical points recur:

Resolve toward the branch's own trajectory. A branch may already contain a commit that deliberately reconciles the very interface in conflict, sitting at its tip. Reading the branch's log before proposing a resolution avoids overriding a decision that was already made — and inventing a third design forces the author to rewrite their work.

Preserve per-commit shape when rebasing. Resolving each intermediate commit toward the branch's final design, rather than jumping straight to it, keeps each commit sound.

A reported conflict is not always real. Hosting platforms cache mergeability and go stale in both directions. Performing the merge locally is the only ground truth; a conflict a platform reports and the tool cannot reproduce should never be hand-resolved.

Additive conflicts have a standard answer. Two branches adding properties to one interface conflict wholesale; the resolution is the union, in whatever order the file already uses.

See also11

Three-Way Merge

Combining two lines of work by comparing both against their common ancestor.

Version Control & Delivery17 connections

Semantic Conflict

Two changes that merge cleanly and are incompatible in meaning.

Version Control & Delivery15 connections

Stacked Pull Requests

A chain of dependent changes, each reviewed separately and merged in order.

Version Control & Delivery12 connections

Merge Train

Validating changes against the state they will actually merge into, in order, rather than in isolation.

Version Control & Delivery14 connections

Rebase

Replaying a branch's commits onto a new base, producing new commits with the same changes.

Version Control & Delivery19 connections

Ground Truth

The measurement that arbitrates, as opposed to the artifact that merely reports.

Method99 connections

Continuous Integration

Automatically building and testing every change, so integration problems surface immediately.

Version Control & Delivery38 connections

Trunk-Based Development

Everyone integrating into one shared branch continuously, with short-lived feature branches.

Version Control & Delivery20 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

Git Stash

Git's shelf for uncommitted work, which clears the working tree so you can switch tasks, and the reasons a throwaway commit or a second worktree is often the better shelf.

Version Control & Delivery10 connections

Linked from14