How do you resolve a merge conflict in Git?
⚡
Quick Answer
Identify conflicts with git status, open the conflicted files and edit the marked regions to the desired result, then git add the resolved files and commit (or continue the rebase/merge).
Detailed Answer
Git marks conflicts with <<<<<<<, =======, >>>>>>> around the competing changes. You reconcile them by hand (or with a merge tool), remove the markers, stage the files, and finish with git commit (merge) or git rebase --continue. Prevent conflicts by pulling/rebasing often and keeping changes small and focused.
💡
Interview Tip
Mention prevention too — frequent integration and small PRs reduce conflicts — not just the mechanical fix.
gitmerge-conflictworkflow