β οΈ This post links to an external website. β οΈ
A merge conflict is annoying once. Resolving the same one again on the next rebase feels like Git charging rent on a decision already made.
Git has a little-known feature for this:
rerere, short for βreuse recorded resolution.β When enabled, it can remember how a conflict was resolved and reuse that fix when that conflict arises again. Simply turn it on by usinggit config --global rerere.enabled true. After resolving a conflict and committing it,rererecan automatically apply the previously recorded fix the next time the same conflict comes up, which is particularly useful when merging upstream changes frequently.However, itβs crucial to inspect the result of any automatic resolution, as
rerereonly remembers the textual resolution, not the intent. If a remembered fix is inappropriate, you can usegit rerere forget file_to_add.pyto erase that resolution and resolve the conflict anew.
continue reading oncode.geohack.top
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.