<<<<<<< and >>>>>>> markers — VS Code's Merge Editor shows Accept buttons for each conflict. Then git add the files and git commit to finish the merge.Guide
Two branches changed the same line and Git paused to let you pick. Here's the calm way through.
You ran git merge (or git pull) and instead of a friendly success
message, Git printed something like this and stopped:
What Git prints
$ CONFLICT (content): Merge conflict in src/app.js
$ Automatic merge failed; fix conflicts and then commit the result. This is Git's message, not commands to run.
First, breathe — nothing is broken and nothing is lost. A conflict isn't an error. It happens when two branches changed the same lines of the same file, and Git — which never guesses about your code — pauses to ask a question only a human can answer: which version do you want? Your job is simply to answer it, then let Git finish.
Git shows you exactly where the disagreement is by writing conflict markers into the file. Both versions are right there, stacked one above the other:
What a conflict looks like in the file
$ <<<<<<< HEAD
$ your version of the line
$ =======
$ the other branch's version
$ >>>>>>> feature-login <<< marker lines if you edit manuallyThese markers are inserted into your file by Git; they are not commands to run.
Mental model: a conflict is a fill-in-the-blank form, not a fire. Git found two answers for the same line, wrote both into the file, and is waiting for you to cross one out. There is no timer — take your time.
You can edit the markers by hand in any editor, but VS Code has a purpose-built Merge Editor that shows both versions side by side and builds the final result for you. Once every conflict is resolved, you finish the merge the normal way: stage and commit.
Resolve, then finish the merge
$ # after fixing each conflicted file:
$ git add .
$ git commit git commit without -m opens an editor with a pre-written merge message — just save and close it.
For a quick one-line conflict, you don't even need the Merge Editor: VS Code shows small inline links right above the markers — Accept Current Change | Accept Incoming Change | Accept Both Changes. One click picks the version and removes the markers for you.
Halfway through and it feels wrong? You never have to finish a merge. One command rewinds everything to the moment before you started, conflicts and all.
Cancel the merge entirely
$ git merge --abort Ctrl+Shift+P)Your branch returns to exactly how it was before the merge. Nothing is lost.
Escape hatch: there is no point in a merge where you're trapped. Until you commit the result, git merge --abort is always available — resolve the conflict tomorrow with fresh eyes if you like.
Merges aren't the only place this happens. git pull (which merges behind the
scenes), git stash pop and git rebase can all raise the identical
situation: same markers, same fix — resolve, stage, continue. The abort command just changes
name (git rebase --abort, for instance). You'll meet one of these in
Stashing.
Up next: shelving half-finished work so you can switch tasks without committing — Stashing Changes.
FAQ
<<<<<<< and >>>>>>> markers — VS Code's Merge Editor shows Accept buttons for each conflict. Then git add the files and git commit to finish the merge.git merge --abort returns everything to exactly how it was before you started the merge. In VS Code, run Git: Abort Merge from the Command Palette. Nothing is lost.git pull, git stash pop and git rebase can raise the same one.<<<<<<< and >>>>>>> markers. Nothing is deleted until you choose what to keep, and git merge --abort rewinds the whole merge.