What is git rerere?
Why Interviewers Ask This
Senior Git & GitHub engineers are expected to reason about architecture, performance, and edge cases. This question separates mid-level from senior candidates by testing deep system-level understanding.
Answer
git rerere (reuse recorded resolution) is a Git feature that records how you resolve merge conflicts and automatically re-applies the same resolution next time the same conflict occurs. This is extremely useful in workflows with frequent rebases or long-lived branches. Enable: git config --global rerere.enabled true. How it works: when you resolve a conflict and commit, Git records the conflicted state and your resolution. Next time Git encounters the same conflict (same "left side" and "right side"), it automatically applies the previous resolution. Rerere storage: .git/rr-cache/. Commands: git rerere status — show files rerere will resolve; git rerere diff — show recorded resolutions that will be applied; git rerere forget file.txt — forget a recorded resolution. Use case: you maintain a long-running feature branch that you regularly rebase onto main. The same files often conflict repeatedly. With rerere, Git remembers your resolutions and applies them automatically, turning a manual process into an automated one. Another use: when a merge conflict resolution was wrong — forget it and redo. Rerere data is local (not pushed to remote).
Pro Tip
This topic has Git & GitHub-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.