Conflicts happen. Resolving them well is a soft skill as much as a technical one.
Rules:
- Talk to the other author before resolving if it's not obvious. The diff shows what changed but not why.
- Prefer their intent + your fix, not blindly accepting one side. Both probably wrote something for a reason.
- Run the tests after — conflicts are often where bugs hide because both sides "looked right".
- Document the resolution in the merge commit body if it's non-trivial.
Workflow:
git fetch origin
git rebase origin/main
# ... conflicts ...
git status # which files
# Edit each file, remove markers
git add <resolved-files>
git rebase --continue
If genuinely stuck: git rebase --abort and ask for help. Better than committing a bad merge.
Enable rerere so Git remembers your resolutions across future rebases:
git config --global rerere.enabled true