Hasty Briefsbeta

Bilingual

Using Git's rerere feature to escape recurring conflict hell

10 hours ago
  • #Git
  • #Development Tools
  • #Merge Conflicts
  • The Git feature 'rerere' (Reuse Recorded Resolution) can automatically resolve repeated merge conflicts by remembering past resolutions.
  • Enable rerere globally with 'git config --global rerere.enabled true', or create '.git/rr-cache' directory in a project.
  • When rerere is enabled, Git records conflicts and their resolutions during merges, allowing automatic re-application in future similar conflicts.
  • During a conflict, use 'git rerere diff' to view resolution states, and after resolving, Git logs the resolution for reuse.
  • Re-merging after a reset shows Git applying past resolutions (e.g., 'Resolved 'user.rb' using previous resolution'), reducing manual effort.