Git merge conflicts: read the markers, fix the file, finish the merge
A conflict is Git asking you to choose, not an error. Learn why it happens, how to read the markers in the file, and the exact steps to fix it and finish the merge.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: two editors on one printed page. Both editors marked the same sentence with different words. The page cannot take both. The editor-in-chief puts the two versions side by side and asks which sentence to print.
Git is the page, and you are the editor-in-chief.
Tom, a tester at Daily List, a to-do list app, gets that page when his branch meets Leo's.
What it is: Git records snapshots of tracked project files and available commit history, with who saved each version and when. It runs on your own computer and works without the internet. GitHub is a different thing: a website that stores Git projects so a team can share them. A is one moment in Git. Two branches contain incompatible changes, so Git stops and asks a person to choose which words stay.
Why it matters: Sooner or later two people change the same lines, and every tester who works with Git meets the stop. A first-time reader sees a wall of strange symbols and fears they broke something. Knowing the steps turns that message into a five-minute job. Start from a clean or backed-up copy so you can abandon a messy merge safely if you need to.
PLAIN WORDS · 2 in this section
- snapshots
- records of how things stood at one moment
- github
- a web site that hosts code and runs checks
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Two editors who marked the same sentence on a printed page.
- Open
- Choose
- Commit
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The two edited sentences | The two versions in the file |
| Putting them side by side | Conflict markers |
| The editor-in-chief | The person resolving |
| Printing the chosen sentence | Staging and committing |
WHERE THIS PICTURE STOPS
- A page holds one sentence, but a file can have many clashes.
- An editor reads both, but Git only marks them.
- A page is printed once, but a merge can be cancelled.
HOOK
Git asks, you choose.
TELL A FRIEND
A page: two edits, one choice.
OFTEN MIXED UP WITH Git branches: work on a copy of the line, then merge it back. That topic merges two branches cleanly. This one fixes a merge that stops on a clash.
Sources & standards — 2 sources
- Market practice
Git git-merge manual (2.51.0) ↗ — Git project · Git 2.51.0 — DESCRIPTION, HOW CONFLICTS ARE PRESENTED, HOW TO RESOLVE CONFLICTS, --abort: ancestry, incompatible changes, markers and reconstruction warning.
Selected publisher sections read for Testing Tools audit. Git 2.51.0. This is not live service testing or a full-publication certification.
- Market practice
Git git-diff manual (2.51.0) ↗ — Git project · Git 2.51.0 — DESCRIPTION: working tree versus index; --cached compares staged changes against HEAD.
Selected publisher sections read for Testing Tools audit. Git 2.51.0. This is not live service testing or a full-publication certification.
PRACTISE AND KEEP
Sources for this topic — 2 sources
- Market practice
Git git-merge manual (2.51.0) ↗ — Git project · Git 2.51.0 — DESCRIPTION, HOW CONFLICTS ARE PRESENTED, HOW TO RESOLVE CONFLICTS, --abort: ancestry, incompatible changes, markers and reconstruction warning.
Selected publisher sections read for Testing Tools audit. Git 2.51.0. This is not live service testing or a full-publication certification.
- Market practice
Git git-diff manual (2.51.0) ↗ — Git project · Git 2.51.0 — DESCRIPTION: working tree versus index; --cached compares staged changes against HEAD.
Selected publisher sections read for Testing Tools audit. Git 2.51.0. This is not live service testing or a full-publication certification.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.