Git Remembers How You Resolved That Conflict — If You Let It
You rebase a long branch onto main . The first commit conflicts in config.yml ; you resolve it. The second commit touches the same lines and conflicts in exactly the same way . So does the third. Each time you re-read both sides, re-make the same decision, and re-type the same lines. Git can remember the resolution. git rerere — reuse recorded resolution — is one config setting, and it comes with…
Git's rerere feature remembers how you resolved conflicts in the past, making future merges easier. When rebasing a long branch onto main, Git records the resolution of conflicts. If you encounter the same conflict again, Git will use the previously recorded resolution. However, Git does not automatically continue the rebase after applying the resolution.
You must manually inspect the resolved file, decide if it's correct, and then stage and continue the rebase. The second rule is that rerere only acts when the conflict is an exact match of the previously seen conflict. If the conflict has changed, rerere will not reuse the previous resolution. It's crucial to manually review the resolved conflict each time, as Git only matches on the conflicted lines, not the surrounding context.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.