Pcornel
Automation · Git

Merge Conflicts

Cheat sheet · https://pcornel.dk/topic.php?topic=5479

Back to the Topic

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 files
  • git diff --name-only --diff-filter=U — list conflicts
  • git 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

BoundaryHealthy evidenceSuspicious evidence
Local stateRepository, HEAD, worktree/index and commit IDs are explicitWrong repo/ref, hidden staged/untracked state or mutable-name ambiguity
History / refsAncestry and branch/tag movement match intentUnexpected rewrite, stale tracking ref or unclear merge base
Remote syncURL/refspec, auth and remote read-back match expected commitsLocal assumptions, rejection, stale fetch or unsafe force update
Downstream proofBuild/reconciliation/target is verified independentlyPush/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

Confirmation

Confirm action

Continue?