Git
Resolve conflicts only once with Git rerere
In Git we sometimes need to fix the same merge conflicts multiple times.
For example: When merging your feature branch into develop
and later merging it into the main
branch.
To prevent resolving the same merge conflicts over and over again, Git has a feature called rerere (Reuse Recorded Resolution).
Run the following command to enable rerere:
git config --global rerere.enabled true
Or edit the .gitconfig
file directly and add:
[rerere]
enabled = true
With rerere enabled, Git will record the resolution when you resolve a conflict. Later when Git encounters the same conflict: It automatically applies the recorded resolution, so you don't have to manually fix it yourself again.
See the documentation for more details.