As every developer knows, fixing merge conflicts can be tedious, but repeatedly solving the same conflict (e.g., in long-running feature branches) is annoying. If you’ve suffered from this, you’ll be happy to learn about the underused reuse recorded resolution feature. Add it to your global config to enable it for all projects:
git config --global rerere.enabled true
Alternatively, you can enable it on a per-project basis by manually creating the directory
This sure isn’t a feature for everyone, but it can be a real-time saver for people who need it. Imagine your team is working on various feature branches at the same time. Now you want to merge all of them into one testable pre-release branch. As expected, there are several merge conflicts, which you resolve. Unfortunately, it turns out that one of the branches isn’t quite there yet, so you decide to un-merge it again. Several days (or weeks) later, when the branch is finally ready, you merge it again, but thanks to the recorded resolutions, you won’t have to resolve the same merge conflicts again.
The man page (
man git-rerere) has more information on further use cases and commands (
git rerere status,
git rerere diff, etc.).