Bird
Raised Fist0
Gitdevops~10 mins

Rerere for repeated conflict resolution in Git - Interactive Code Practice

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
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to enable Git's rerere feature globally.

Git
git config --global rerere.[1] true
Drag options to blanks, or click blank then click option'
Aenabled
Bauto
Cuse
Denable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rerere.enable' instead of 'rerere.enabled'.
Forgetting to set the value to 'true'.
2fill in blank
medium

Complete the command to manually record a conflict resolution using rerere.

Git
git rerere [1]
Drag options to blanks, or click blank then click option'
Aforget
Bstatus
Cclear
Drecord
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git rerere clear' which deletes recorded resolutions.
Using 'git rerere status' which only shows rerere status.
3fill in blank
hard

Fix the error in this command to show the current rerere status.

Git
git rerere [1]
Drag options to blanks, or click blank then click option'
Alist
Bshow
Cstatus
Dcheck
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git rerere show' which is not a valid command.
Using 'git rerere list' which does not exist.
4fill in blank
hard

Fill both blanks to create a rerere cache directory and configure Git to use it.

Git
mkdir -p [1] && git config rerere.[2] [1]
Drag options to blanks, or click blank then click option'
A~/.git_rerere_cache
Bdir
Ccache
D~/.cache/git_rerere
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rerere.cache' instead of 'rerere.dir'.
Using a directory path without creating it first.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps conflicted files to their resolution status using rerere.

Git
conflicts = {file: git rerere [1] for file in [2] if git rerere [3] file}
Drag options to blanks, or click blank then click option'
Astatus
Bconflicted_files
Cresolved
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' instead of 'conflicted_files' for iteration.
Using 'git rerere list' which is not a valid command.

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