Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Git

Git: Fix rerere Replaying a Resolution You Already Reverted

- 02.12.26 - ErcanOPAK

🔀 Git: Fix rerere Replaying a Resolution You Already Reverted

With rerere.enabled turned on, Git records how you resolved a merge conflict the first time and automatically reapplies that exact same resolution the next time an identical conflict shows up — which is a genuine time-saver during a long interactive rebase with repeated conflicts, but it has no concept of “I changed my mind about that resolution later.” If you resolve a conflict once, realize partway through the rebase that the resolution was wrong, and manually fix it differently in a later step, rerere’s recorded resolution record for that exact conflict pattern doesn’t get updated — it’s still sitting in .git/rr-cache with the original (now-wrong) answer, ready to silently reapply itself the next time Git sees that same conflicting hunk, including on a completely different branch or a rebase run weeks later.

🔎 The Problem

$ git rebase main
Auto-merging src/config.js
CONFLICT (content): Merge conflict in src/config.js
  <- you resolve this by keeping YOUR side

# ...three commits later in the same rebase, you realize that
# resolution was wrong and manually fix config.js differently
# in a later commit instead of going back to redo the conflict

# Weeks later, a different rebase hits the exact same conflict pattern:
$ git rebase main
Auto-merging src/config.js
Resolved 'src/config.js' using previous resolution.
  <- rerere silently reapplies the FIRST (wrong, already-superseded)
     resolution, with no conflict markers shown and no prompt to review it

✅ Fix: Clear or Update the Recorded Resolution When You Change Your Mind

  • Run git rerere forget <path> for any file whose conflict resolution you end up changing later in the same rebase, which removes the stale recorded resolution so the next identical conflict shows real conflict markers again instead of silently auto-resolving to the old answer.
  • Review what rerere is about to auto-apply with git rerere diff before trusting an auto-resolved file, especially on a long-lived branch where conflict patterns recorded weeks or months ago might no longer reflect the current, correct resolution.
  • Periodically clear old entries with git rerere gc (or manually prune .git/rr-cache) on repositories where conflict resolutions have genuinely changed over the project’s history, since rerere has no built-in expiration and will happily keep replaying a years-old resolution forever if the exact same conflict pattern ever recurs.

🚨 Why This Is Dangerous

  • An auto-resolved conflict shows no markers and asks for no review, so a stale rerere resolution silently reintroducing an already-reverted mistake can slip straight into a commit and through code review, since the diff looks like a clean, deliberate merge rather than a conflict that was ever in question.

rerere remembers how you resolved a conflict, not whether you were right — and it will keep being confidently, silently wrong until you explicitly tell it to forget.

— Version Control Tip

Related posts:

Git: Fix a Shallow Clone Rejected by a Branch Protection Rule

Git: Fix a Shallow Clone Rejected by a Branch Protection Rule

Git: Fix git worktree add Checking Out a Branch That Silently Diverges From the Same Branch in the M...

Git: Fix git worktree add Checking Out a Branch That Silently Diverges From the Same Branch in the M...

Git: Use .gitignore to Exclude Files

Git: Use .gitignore to Exclude Files

Views: 0
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

The AI Prompt That Sniffs Out an Auth Timing Side-Channel
SQL Server: Fix an Extended Events Session Filling Its Target File

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,080 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 869 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 672 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 585 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 562 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com