merge conflict
The situation where two branches changed the same lines differently since their merge base, so Git cannot combine them and asks you to choose.
In more detail
Git merges everything else automatically, then pauses and marks each clash in the file with conflict markers. You edit the file to the result you want, git add it to mark it resolved, and commit to finish, or abandon the merge with git merge --abort. A clean text merge is not proof the program works, so test afterwards.
Examples
A shared changelog edited by many pull requests conflicts constantly; Changesets gives each change its own file instead.long 9 commits behind trunk merge conflict conflicted files 1git add shopping.txtRelated terms
- Git — A free, open-source distributed version control system that records the history of a project as a chain of snapshots.
- Changesets — A tool where each pull request adds a small Markdown file describing its change and its version bump, later combined into releases and changelogs.
- pull request — A request on a hosting service such as GitHub to merge one branch into another, with a page for review, discussion and automated checks.
- merge — Combining the work of two branches into one, either by moving a branch forward (a fast-forward) or by recording a merge commit.
- semantic conflict — A clash in meaning between two changes that merge cleanly as text but break the program together.
- branch — In Git, a movable name for one commit; committing on the branch moves the name forward to the new commit.
- merge base — The newest commit that two branches both contain, the point where their histories split.
- conflict markers — The lines Git writes into a conflicted file: <<<<<<< starts your side, ======= separates the two versions, and >>>>>>> ends their side.
- ours and theirs — During a merge, ours is the branch you are on and theirs is the branch being merged in.
- --abort — A flag that cancels a merge, rebase or cherry-pick that has stopped part way, returning everything to how it was before you started.
Taught in
- System Governance: Changesets, Semantic Versioning & Deprecation — Design Systems & Component Engineering
- Trunk-Based Development Versus Git Flow — DevOps & Site Reliability Engineering
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows
- Why Conflicts Happen — Advanced Git Internals & Distributed Workflows
- Resolving A Conflict, Line By Line — Advanced Git Internals & Distributed Workflows
- Trunk Based Development Versus Git Flow — Advanced Git Internals & Distributed Workflows