Merge Conflicts

Updated

October 30, 2026

Merge Conflicts: In Git and in Teams

After this page you can finish a conflicted merge on Linux and leave a clean main.

What a conflict is

Both branches changed the same region of a file (or one side changed a file the other deleted). Git writes conflict markers into the working tree and leaves the merge unfinished.

<<<<<<< HEAD
return "ok"
=======
return {"status": "ok"}
>>>>>>> feat/ping-json

With zdiff3 you also get an ancestor block (|||||||).

The loop

git switch main
git merge feat/ping-json
# Git stops and prints "fix conflicts and then commit"

git status
# both modified: src/ping.py

Edit the file in nvim. Remove every <<<<<<<, =======, >>>>>>> (and ||||||| if present). Leave the code you want.

git add src/ping.py
git status          # "all conflicts fixed"
git commit          # default message is "Merge branch 'feat/ping-json'"

Git opens core.editor for the merge message if you omit -m. A conventional subject is optional here; merge commits are often left as Git’s default so git log --first-parent stays readable.

Abort vs continue

git merge --abort     # give up; back to pre-merge

After git add, there is no --continue for merge; git commit finishes it. Rebase does use --continue (chapter 9).

Binary files and deletes

git status will say deleted by them or added by us. Pick a side:

git restore --ours --worktree --staged path
git restore --theirs --worktree --staged path
git rm path

Then git add / git commit as usual.

Teams

A conflict is a data problem (two diffs) plus a people problem (whose behavior should win). On a forge, the same markers appear in the pull-request UI. Resolve on your laptop, commit, push. Do not resolve only in the UI if you cannot run the tests; Linux is where desk-api actually runs.

rerere (chapter 2) records how you resolved a hunk and reapplies it if the same conflict comes back. Leave it enabled.

After the merge

git log --oneline --graph --decorate --all
git branch -d feat/ping-json

-d succeeds once the work is reachable from main.