rerere = Reuse Recorded Resolution: git ghi nhớ cách bạn resolve conflict, và tự động replay resolution đó khi gặp cùng conflict.
Enable:
git config --global rerere.enabled trueKhi nào cứu bạn:
Scenario 1 - Long rebase: feature branch 20 commits, rebase lên main, commit thứ 3 có conflict X. Bạn resolve. Commit thứ 15 có cùng conflict X → rerere tự resolve.
Scenario 2 - Release branch: merge release branch vào main mỗi tháng, cùng một config conflict xuất hiện mỗi lần → rerere nhớ, không cần resolve lại.
Scenario 3 - Topic branches: nhiều feature branches merge vào integration branch để test, cùng conflict xuất hiện nhiều lần qua ngày → rerere tái dùng resolution.
Cách hoạt động:
git rerere diff # xem resolutions đã ghi nhớ
git rerere forget # xóa 1 resolution nếu saiLưu ý: rerere chỉ hoạt động nếu conflict markers giống hệt nhau (same file, same context lines).
Nếu code xung quanh thay đổi, rerere không match được.