Knowledge Maxxing
← Back to topic library
Dev MaxxingBeginnerGit75 sec

Merge conflict

A merge conflict happens when Git cannot automatically combine changes from two branches because both modified the same part of a file differently.

Prerequisite: Git branch

What matters

Resolving a conflict requires a person to manually decide which changes to keep, since Git has no way to know which version reflects the intended outcome.

Example

If one branch changes a line to 'return true;' and another changes the same line to 'return false;', merging the two branches produces a conflict Git can't resolve alone.

Common misconception

A merge conflict does not mean something has gone wrong or broken; it is an expected, normal situation whenever two branches edit the same lines differently.

Recall question

Why can't Git automatically resolve every merge conflict on its own?

Keywords and related concepts

merge conflictGitversion controlgit branch

Related topics

Git branch
Dev MaxxingBeginner
Git commit
Dev MaxxingBeginner