The first merge conflict is a rite of passage, usually accompanied by mild panic. Don't. A conflict just means two branches changed the same lines and Git won't guess which you want — it's asking you to decide. Here's exactly how.
What you'll see
After a merge or rebase that conflicts, Git pauses and marks the clashing region in the file:
<<<<<<< HEAD
const timeout = 5000; // your branch's version
=======
const timeout = 10000; // the incoming branch's version
>>>>>>> main- Everything between <<<<<<< HEAD and ======= is YOUR current branch.
- Everything between ======= and >>>>>>> is the INCOMING change.
- Your job: edit the region to the correct final result, then delete all three marker lines.
Resolve it
git status # lists files "both modified" — these have conflicts
# open each one, fix the <<<<<<< ... >>>>>>> regions to the final code
git add config.ts # mark this file resolved
git commit # (for a merge) finalise — or:
git rebase --continue # (for a rebase) carry onYour editor almost certainly has a conflict UI (VS Code shows 'Accept Current / Incoming / Both' buttons above each region). It's far less error-prone than hand-deleting markers — use it.
When you want to pick one side wholesale
git checkout --ours config.ts # keep YOUR version entirely
git checkout --theirs config.ts # take THEIRS entirely
git add config.tsEscape hatch: abort and start over
Lost or overwhelmed? You can always back out and return to before the merge/rebase — nothing is committed until you say so.
git merge --abort # undo an in-progress merge
git rebase --abort # undo an in-progress rebaseA conflict is Git deferring a judgement call to you, not a disaster. Read the markers, edit to the right result, git add, continue — or abort and try again. After three or four, the panic is gone for good.