Worst case conflict: không phải thêm/xóa dòng đơn giản mà là structural refactor — function bị rename, logic được reorganize.
Quy trình an toàn:
1. Hiểu context trước khi resolve:
bash
git log --oneline main..feature/my-branch # xem commits của feature
git log --oneline feature/my-branch..main # xem commits của main
git diff $(git merge-base HEAD feature/my-branch) feature/my-branch -- src/file.ts
# Xem feature branch đã thay đổi gì**2.
Dùng 3-panel merge tool (không resolve bằng tay trong terminal):**
bash
git mergetool # opens configured tool
# Left: ours, Right: theirs, Center: base (common ancestor)
# Bottom: result**3.
Resolve và verify:**
bash
git add src/file.ts
# CHƯA commit — chạy tests trước:
npm test -- --testPathPattern=file.ts
# Nếu pass:
git merge --continue**4.
Sau merge — review lại result:**
bash
git diff main~1..main -- src/file.ts # xem diff của merge commitNguyên tắc: khi không chắc, chọn solution bảo toàn logic của cả 2 sides thay vì chọn 1 side.
Đừng dùng -X ours hay -X theirs với structural conflicts.