# Merge Conflict

> Two branches changed the same lines, so Git asks you to choose what stays.

**Field:** Software Development  
**Category:** Version Control  
**Also known as:** Git Conflict, Conflict

## Think of it like

Think of it like two people writing on the same line of a card. Someone has to pick what it says.

## Definition

A merge conflict happens when two branches change the same lines in different ways. Git cannot guess which version is right, so it stops and asks you. It marks the spot in the file with <<<<<<<, ======= and >>>>>>> lines around both versions. You edit the file to keep what you want, remove the markers and commit. Conflicts are normal and not a sign that anything is broken.

## Example

Jack made the greeting blue and Emma made it red. When they merge, Git shows both lines and Jack picks one.

## Example code

```text
<<<<<<< HEAD
Hello, blue
=======
Hello, red
>>>>>>> red
```

Your version is above the line of equals signs; the other branch is below.

## Why it matters

Conflicts happen on every team. Knowing how to read the markers turns a scary moment into a quick fix.

## Common mistake

Committing the file with the markers still in it. The code then breaks, often in a strange way.

## Three principles

- **Same lines, two changes.** Git cannot pick for you.
- **Markers show both.** Yours on top, theirs below.
- **Edit, then commit.** Remove the markers when done.

## Related terms

- [Merge](https://learn.benibix.com/term/development/merge)
- [Branch](https://learn.benibix.com/term/development/branch)
- [Diff](https://learn.benibix.com/term/development/diff)
- [Rebase](https://learn.benibix.com/term/development/rebase)

## Taught in

- [Git Merge and Conflicts](https://learn.benibix.com/learn/development-version-control/git-merge-and-conflicts): Git and GitHub, 5/13

---

Source: https://learn.benibix.com/term/development/merge-conflict
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
