Q: `git rerere` is enabled in your config. What does it do, and in what workflows does it save the most time?
rerere stands for "reuse recorded resolution." When enabled (git config --global rerere.enabled true), Git silently records how you resol...
#Git #From your main checkout (on feature/new-api): #L2 #Version Control #Collaboration #Rebase
🎙️ Candidate Opening & Architectural Context
""During a major release branch cut, we encountered this exact scenario and used Git internals to recover cleanly. The interviewer is testing: Understanding of rerere (reuse recorded resolution) and its niche but powerful use case.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
rerere stands for "reuse recorded resolution." When enabled (git config --global rerere.enabled true), Git silently records how you resolved each merge conflict. If the *exact same* conflict appears again later, Git applies the same resolution automatically.
- You hit a conflict during merge or rebase and manually resolve it.
- Git records the conflict (before) and resolution (after) in
.git/rr-cache/. - Next time the same conflict appears (same pre-image), Git auto-applies your recorded resolution. You still need to
git addand commit, but the file is already correctly resolved. - Long-lived feature branches that you repeatedly rebase onto
main. Each rebase replays all commits, and the same conflicts keep appearing. With rerere, you resolve each conflict once; subsequent rebases are automatic. - Topic branch workflows where you test-merge branches into an integration branch, then discard the merge and re-merge later for the real release. Without rerere, you re-resolve every conflict.
2️⃣
Remediation & Permanent Safeguards
How it works: Where it shines: Caveats:
- Cherry-pick-heavy workflows (backporting fixes across release branches) where similar conflicts recur.
- The cache is local — not shared across clones. Each developer's rerere database is separate.
- If you resolve a conflict incorrectly, rerere will faithfully re-apply the wrong resolution. Use
git rerere forgetto clear a bad recording. git rerere gccleans up old recordings (default: unresolved conflicts older than 15 days, resolved ones older than 60 days).
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: You hit a conflict during merge or rebase and manually resolve it.."
⚡ 60-Second Elevator Pitch Talking Points
- You hit a conflict during merge or rebase and manually resolve it.
- Git records the conflict (before) and resolution (after) in .git/rr-cache/.
- Next time the same conflict appears (same pre-image), Git auto-applies your recorded resolution. ...
Advertisement