You keep resolving the same conflicts again and again while rebasing a long-lived branch. How do you stop?
IntermediateScenarioBranching and Merging Workflows
Answer
Situation read → Each replayed commit hits the same hunks, and you redo the resolution every time.
What I'd do →
- Enable rerere (reuse recorded resolution):
git config --global rerere.enabled true. - Resolve once; Git records the preimage and your resolution under
.git/rr-cache. - On later rebases or merges the same conflict is auto-resolved. Review with
git diffand stage. - If a recorded resolution is wrong:
git rerere forget <path>.
Why → Git fingerprints the conflict text and replays your earlier answer.
Interview tip → rerere only records resolutions, it does not auto-stage them, so you still review.
More on Branching and Merging Workflows
You run `git pull` and Git stops with a merge conflict in `app.py`. What do you do?BeginnerYour feature branch is three weeks old and `main` has moved a lot. Merge `main` in, or rebase onto it?IntermediateThe team argues about fast-forward merges versus merge commits on `main`. How do you settle it?BeginnerA teammate branched from the wrong base, and their PR shows 40 unrelated commits. How do you fix it?IntermediateBefore merging, you want to see exactly what the feature branch adds compared to `main`. Which commands?BeginnerHalfway through a merge you realise you pulled the wrong branch. How do you back out?Beginner