Retroactive Rerere

Thanks to some sick Git magic, I was able to save a PR. rerere replays successful conflict resolutions in other branches. It has to be enabled with a config setting: git config --global rerere.enabled true. However, it has to be enabled at the time the merge process begins. Since I had already resolved the conflicts it was of no help.

However, thanks to some even sicker Git magic I was able to replay the merge commit with rerere enabled so it could learn about the conflict resolutions it had previously missed, using the following steps:

  1. git log -1 – Note the merge commit hash.
  2. git reset --hard HEAD^ – Undo the merge commit.
  3. git merge origin/develop – Begin merging again. rerere reports it is watching the merge.
  4. git read-tree --reset -u mergecommit – Reset the state of the tree to the original merge commit.
  5. git commit – Complete the merge with the original resolutions applied. rerere learns about the resolutions.

At this point we can return to the other branches and merge develop and let rerere apply the same conflict resolutions to them.