Preliminary Findings on Merge Conflict Fatigue
The code change is ten lines. The merge conflict is forty lines. Most of the forty lines are infrastructure that two developers touched independently without knowing about each other.
PRELIMINARY FINDINGS Subject: Merge conflict arising from parallel development Scope: Broader than anticipated
The Situation
A feature was developed over four days on a branch that diverged from the main branch on Monday. During those four days, two other merges occurred on the main branch. One of those merges touched the same file.
The feature is ten lines of code. The merge conflict is forty lines.
Why It Is Forty Lines
The forty-line conflict contains:
- The ten lines of the feature (the developer's own work, well understood)
- Fourteen lines from the other merge that modified the same area (new information)
- Sixteen lines of surrounding context that the conflict tool includes to show the relationship between both sets of changes
The developer must now: understand the fourteen lines of the other merge, determine how they interact with the feature's ten lines, decide how to combine both changes correctly, and verify that the combined result behaves as expected.
The Fatigue
The fatigue is not from the code. It is from the reconstruction. The developer must temporarily inhabit the mental model of the other person who wrote the fourteen lines, understand why they changed what they changed, and integrate it with their own work.
This is four days of context compression for someone who wasn't there for it.
The Finding
The conflict is resolvable. Most are. The resolution requires forty minutes for ten lines of change, because the conflict surface is larger than the change surface.
This is the normal cost of parallel development. It is also mildly exhausting every time, regardless of knowing this.