Merge Conflicts
Cheat sheet · https://pcornel.dk/topic.php?topic=5479
Answer
Merge conflicts occur when Git cannot automatically choose a single result for competing changes; resolving them requires reconstructing intended semantics, not merely deleting conflict markers.
Remember
- Conflict markers removed ≠ merge semantically correct; a syntactically clean file can still combine logic incorrectly.
- Ours/theirs labels ≠ always intuitive source/destination during rebase; operation context changes interpretation.
- All files staged ≠ all conflicts correctly resolved; staging records a choice but does not validate it.
- Conflict resolved locally ≠ collaboration complete; final history still needs review, tests and publication.
First checks
git status— conflicted filesgit diff --name-only --diff-filter=U— list conflictsgit mergetool— resolve with tool
Verify in this order
merge → conflict → resolve → test → commit
Where it usually breaks
Git accepting conflict resolution proves the index no longer contains unresolved entries; it does not prove the chosen content is semantically correct.
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Merge Conflicts Git boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Local state | Repository, HEAD, worktree/index and commit IDs are explicit | Wrong repo/ref, hidden staged/untracked state or mutable-name ambiguity |
| History / refs | Ancestry and branch/tag movement match intent | Unexpected rewrite, stale tracking ref or unclear merge base |
| Remote sync | URL/refspec, auth and remote read-back match expected commits | Local assumptions, rejection, stale fetch or unsafe force update |
| Downstream proof | Build/reconciliation/target is verified independently | Push/tag/merge success treated as deployment success |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5479