Cloud & Software Development

Merge conflict

Also known as: Git merge conflict, merge conflicts, conflict resolution (Git)

A merge conflict occurs when version control software such as Git tries to combine changes from different branches but finds that the same lines of a file were changed in different ways.

Since the software can't know which version is right, it pauses and marks the conflicting sections for a person to resolve. While merge conflicts can be stressful, they're a normal part of teamwork, and small, frequent merges make them rare and easy.

Merge conflict, explained at three levels

At home

A merge conflict is like two people editing the same sentence in a shared document at the same time, each in a different way. Edits to different parts of a file combine on their own. When both people changed the exact same lines, though, the software cannot guess which version is right, so it stops, marks both versions side by side and waits for a person to choose.

At work

A merge conflict happens when version control tries to combine two developers' work and finds that both changed the same lines differently. The software pauses and marks the clash so someone can decide what the final code should say. Businesses care because conflicts cost time and can introduce bugs, and they grow when people work separately for too long before combining their changes.

Real-world examples

At home

Lena and a classmate both edited the same function in their group project. Git flagged a merge conflict, and they combined the best parts of each version.

At work

Jerome leads a Saskatoon development team. After constant merge conflicts, he switched the team to smaller daily merges, and conflicts almost disappeared.

Common confusions

  • A merge conflict means someone made a mistake. — It just means two valid changes touched the same lines. It's a normal part of collaboration.
  • If Git merges without conflicts, the code works. — Changes can combine cleanly yet still break each other. Tests are still needed.

For analysts

When teams complain about merge conflicts, I'd look at branch lifespans and work allocation. Process fixes usually work better than tool changes.

History & origin

Merge conflicts have existed as long as people have edited shared files. Early version control systems avoided them by locking files so only one person could edit at a time. CVS and Subversion allowed simultaneous editing with merging, and Git, from 2005, made branching and merging easy and frequent. Visual merge tools in editors such as Visual Studio Code made conflicts easier to resolve, and practices such as trunk-based development and continuous integration encouraged merging small changes often. AI coding assistants began suggesting conflict resolutions in the mid-2020s. In my view, frequent merge conflicts are usually a sign of process problems, not tool problems.