Git & GitHub Interview Question #41
What is a merge conflict?
Remotes, Fetch, Pull, Push, Merge, Conflicts, Rebase & Stash Mid-Level Intermediate
Quick Interview Answer
A merge conflict occurs when Git cannot safely determine how competing changes should be combined. A common example is when two branches modify the same lines differently, although conflicts can also involve file deletion, renaming, or other incompatible changes.
Detailed Explanation
A merge conflict occurs when Git cannot safely determine how competing changes should be combined. A common example is when two branches modify the same lines differently, although conflicts can also involve file deletion, renaming, or other incompatible changes.
Git marks the affected paths as unmerged and requires a developer to decide the correct final content before the merge can be completed.
Code Example
git merge feature/profile
# If conflicts occur:
git status
# After resolving files:
git add resolved-file.cs
git commit