Let’s do the rerere — GIT users

Richard Lobo
2 min readApr 20, 2021

--

Git surprises me every time I discover a new feature. Today its the “git rerere” — that stands for reuse recorded resolution.

To configure, use the git global config setting.

git config --global rerere.enabled true

Now, when does it come handy? The use case of this command you may come across in any team that uses Git.

You have a feature that need to be developed. Let’s say you are the lucky one and has got an opportunity to develop a feature that needs 2 or maybe 3 Sprints and the rest of your team is working on bug fixes from last release. So the master branch may have multiple commits till your feature is complete. And as we all know, multiple commits for your team members means a LOT of merge conflicts.

This is where “git rerere” comes in handy. So this would the be git flow to optimize its use.

  1. Merge master to feature branch at regular intervals.
  2. Merge conflicts can be viewed (optionally) with the command

git rerere status or git rerere diff

3. Resolve the conflict and now Git will record your merge resolution.

4. Undo the merge of master from your feature branch and continue your development.

Now, when you are feature complete and want to do the final merge to master, Git will make your life easy. All the merge conflicts which were resolved earlier will be done automatically for you with merge resolution done earlier. Git will remember all the resolutions for you.

Isn’t that great!

Give a try to this feature of Git and let me know your experience. Below is the Git link with more detailed explanation of this command.

Source:

https://git-scm.com/book/en/v2/Git-Tools-Rerere#:~:text=The%20git%20rerere%20functionality%20is,resolve%20it%20for%20you%20automatically.

Happy Coding!!!

--

--