Bird
Raised Fist0
Gitdevops~5 mins

Rerere for repeated conflict resolution in Git - Cheat Sheet & Quick Revision

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does 'rerere' stand for in Git?
'rerere' stands for "reuse recorded resolution." It helps Git remember how you resolved conflicts before and apply the same fix automatically next time.
Click to reveal answer
beginner
How do you enable rerere in Git?
You enable rerere by running the command: git config --global rerere.enabled true. This tells Git to start remembering conflict resolutions.
Click to reveal answer
intermediate
What happens when Git rerere detects a conflict it has seen before?
Git automatically applies the previously recorded resolution to the conflict, saving you time and effort in fixing the same conflict again.
Click to reveal answer
intermediate
Where does Git store the conflict resolutions recorded by rerere?
Git stores them in the .git/rr-cache directory inside your repository.
Click to reveal answer
intermediate
Can rerere be used with merge and rebase operations?
Yes, rerere works with both merge and rebase to help automatically resolve conflicts you have fixed before.
Click to reveal answer
What is the main purpose of Git rerere?
ATo automatically commit changes
BTo remember and reuse conflict resolutions
CTo delete branches safely
DTo speed up cloning repositories
How do you enable rerere in Git?
Agit config --global rerere.enabled true
Bgit rerere enable
Cgit enable rerere
Dgit rerere start
Where does Git store rerere conflict resolutions?
A.git/cache
B.git/conflicts
C.git/resolutions
D.git/rr-cache
Which Git operations benefit from rerere?
AMerge and rebase
BClone and fetch
CPush and pull
DInit and status
If rerere is enabled, what happens when you face a conflict you've resolved before?
AGit ignores the conflict
BGit deletes the conflicting files
CGit applies the previous resolution automatically
DGit asks you to resolve it again manually
Explain how Git rerere helps with repeated conflict resolution.
Think about how you might not want to fix the same problem twice.
You got /3 concepts.
    Describe the steps to enable and use rerere in your Git workflow.
    Start with the configuration, then what happens during conflict.
    You got /4 concepts.

      Practice

      (1/5)
      1. What is the main purpose of git rerere in conflict resolution?
      easy
      A. It creates a backup of your repository before merging.
      B. It remembers how you resolved conflicts before and reuses those resolutions.
      C. It deletes conflicting files after a merge.
      D. It automatically merges branches without any conflicts.

      Solution

      1. Step 1: Understand what rerere stands for

        Rerere means "reuse recorded resolution" and helps with repeated conflicts.
      2. Step 2: Identify its function in Git

        It saves conflict resolutions and applies them automatically if the same conflict happens again.
      3. Final Answer:

        It remembers how you resolved conflicts before and reuses those resolutions. -> Option B
      4. Quick Check:

        Rerere = reuse recorded resolution [OK]
      Hint: Rerere reuses your past conflict fixes automatically [OK]
      Common Mistakes:
      • Thinking rerere merges without conflicts
      • Believing rerere deletes files
      • Assuming rerere backs up the repo
      2. Which command correctly enables rerere globally in Git?
      easy
      A. git config --global rerere.enabled true
      B. git config --global rerere.enable true
      C. git rerere enable --global
      D. git config rerere.enabled true --global

      Solution

      1. Step 1: Recall the correct config syntax for rerere

        The correct key is "rerere.enabled" with a dot, not "rerere.enable".
      2. Step 2: Confirm the global flag placement

        The global flag comes immediately after "config" and before the key-value pair.
      3. Final Answer:

        git config --global rerere.enabled true -> Option A
      4. Quick Check:

        Correct syntax uses rerere.enabled with --global [OK]
      Hint: Use 'rerere.enabled' with --global to enable rerere [OK]
      Common Mistakes:
      • Using rerere.enable instead of rerere.enabled
      • Placing --global after the key-value pair
      • Using 'git rerere enable' command which doesn't exist
      3. Given this sequence of commands, what will git status show after the second merge if rerere is enabled?
      git config --global rerere.enabled true
      git checkout feature
      # merge master with conflicts
      # resolve conflicts manually and commit
      
      git checkout feature
      # merge master again with same conflicts
      medium
      A. No conflicts, because rerere applied previous resolutions automatically.
      B. Conflicts remain and must be resolved again manually.
      C. Merge fails with an error about unresolved conflicts.
      D. Git deletes the conflicting files automatically.

      Solution

      1. Step 1: Understand rerere behavior on repeated conflicts

        When rerere is enabled, it remembers how you fixed conflicts and applies those fixes automatically on the same conflict.
      2. Step 2: Analyze the second merge scenario

        The second merge has the same conflicts, so rerere applies the previous resolution, avoiding manual conflict fixing.
      3. Final Answer:

        No conflicts, because rerere applied previous resolutions automatically. -> Option A
      4. Quick Check:

        Rerere auto-applies fixes on repeated conflicts [OK]
      Hint: Rerere auto-fixes repeated conflicts after first manual fix [OK]
      Common Mistakes:
      • Expecting conflicts again despite rerere
      • Thinking merge will fail with error
      • Assuming files get deleted automatically
      4. You enabled rerere but notice it does not apply previous conflict resolutions automatically. What is a likely cause?
      medium
      A. You enabled rerere only locally, not globally.
      B. You used git rerere clear before the second merge.
      C. You forgot to commit the conflict resolution the first time.
      D. You merged branches with no conflicts.

      Solution

      1. Step 1: Understand how rerere records resolutions

        Rerere saves conflict resolutions only after you commit the resolved merge.
      2. Step 2: Identify why rerere might not apply fixes

        If you did not commit the resolution, rerere has no record to reuse, so it cannot auto-apply fixes.
      3. Final Answer:

        You forgot to commit the conflict resolution the first time. -> Option C
      4. Quick Check:

        Rerere needs committed resolutions to reuse [OK]
      Hint: Commit conflict fixes first for rerere to remember them [OK]
      Common Mistakes:
      • Assuming rerere works without committing resolutions
      • Confusing rerere clearing with enabling
      • Thinking local vs global enable affects this issue
      5. You have a project where the same conflict happens often between two branches. How can you use rerere to save time and avoid repeated manual fixes? Choose the best approach.
      hard
      A. Run git rerere clear before every merge to reset conflict history.
      B. Disable rerere and always resolve conflicts manually to avoid mistakes.
      C. Use rerere only on one branch and manually copy resolutions to the other branch.
      D. Enable rerere globally, resolve the conflict once and commit, then rerere will auto-apply fixes on future merges.

      Solution

      1. Step 1: Enable rerere globally for all repositories

        This ensures rerere is active and can record conflict resolutions anywhere.
      2. Step 2: Resolve the conflict once and commit the fix

        Rerere records this resolution to reuse it automatically on repeated conflicts.
      3. Step 3: Benefit from rerere auto-applying fixes on future merges

        This saves time by avoiding repeated manual conflict resolution.
      4. Final Answer:

        Enable rerere globally, resolve the conflict once and commit, then rerere will auto-apply fixes on future merges. -> Option D
      5. Quick Check:

        Enable + commit fix = rerere auto-applies [OK]
      Hint: Enable rerere, commit fix once, future merges auto-fix [OK]
      Common Mistakes:
      • Disabling rerere loses automation benefits
      • Using rerere only on one branch misses conflicts
      • Clearing rerere history removes saved fixes