World map

 

BM: Baca dalam Bahasa Melayu

World 10: Deep Git

rerere and range-diff

You will learn: how Git can remember conflict fixes, and how to compare two versions of a branch.

The problem

You rebase a long branch every week. The same conflict comes back every time. Must you fix it by hand again and again?

Pick one answer.

Watch

rerere: "Reuse recorded resolution": Git remembers how you fixed a conflict and does it again next time. means “reuse recorded resolution”. Git remembers how you fixed a conflict. Tap to see what happens next time.

Tap each point on the timeline.

Try it

Turn rerere on for all your projects. One setting is enough.

Predict

rerere fixed a conflict for you during a rebase. What should you still do?

Pick one answer.

Watch

bash
git rebase main
git range-diff main feature@{1} feature
Two commands: git rebase main, then git range-diff main feature@{1} feature.

After a rebase, did any commit change? range-diff: Compares two versions of a branch, commit by commit. compares two versions of a branch, commit by commit. feature@{1} is the branch before the rebase.

Check

range-diff marks each pair of commits. = means “the same”. What does ! mean?

Pick one answer.

Check

rerere or range-diff? Which helps here?

Drag a card into a box. Or tap the card, then tap the box.

      You did it!

      You can now reuse conflict fixes and compare versions of a branch.

      Go deeper (optional)

      Recorded fixes live in .git/rr-cache. git rerere forget index.html drops a bad one. Set rerere.autoUpdate to true to add replayed fixes for you. git range-diff main...feature compares two branches that share a base. The practice terminal only explains these commands.