Git — small conflicts
Advanced Resolve without panic.When it happens
bash
git pull
# or
git merge origin/main
# or
git rebase origin/mainGit stops and marks conflicted files.
bash
git statusResolve loop
- Open each conflicted file
- Find markers:
text
<<<<<<< HEAD
your side
=======
their side
>>>>>>> branch-name- Edit to the correct final content (remove markers)
- Stage and continue:
Merge
bash
git add path/to/fixed-file
git commit # completes the merge (editor opens)Rebase
bash
git add path/to/fixed-file
git rebase --continueAbort (back out)
bash
git merge --abort
git rebase --abortTools that help
bash
git mergetool
# or open in VS Code / JetBrains merge UI
code --merge ...“I took all of theirs / ours”
bash
# during merge:
git checkout --ours path/to/file
git checkout --theirs path/to/file
git add path/to/fileWARNING
--ours / --theirs flip meaning during rebase vs merge. When unsure, open the file.
After a messy conflict
bash
git status
git diff --check # leftover conflict markers?
rg '<<<<<<|======|>>>>>>' # if you have ripgrep