Challenge - 5 Problems
Conflict Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Identify the conflict content from Git conflict markers
Given the following conflict markers in a file after a merge conflict, what is the content from the current branch (HEAD)?
<<<<<<< HEAD Line A ======= Line B >>>>>>> feature-branch
Git
<<<<<<< HEAD Line A ======= Line B >>>>>>> feature-branch
Attempts:
2 left
💡 Hint
The content between <<<<<<< HEAD and ======= is from the current branch.
✗ Incorrect
In Git conflict markers, the section between <<<<<<< HEAD and ======= shows the current branch's content. The section after ======= until >>>>>>> shows the incoming branch's content.
💻 Command Output
intermediate1:30remaining
What does Git show after a merge conflict?
After running
What does this indicate?
git merge feature, you see conflict markers in a file:<<<<<<< HEAD int x = 5; ======= int x = 10; >>>>>>> feature
What does this indicate?
Git
git merge featureAttempts:
2 left
💡 Hint
Conflict markers appear only when Git cannot automatically merge changes.
✗ Incorrect
Git shows conflict markers when it cannot merge changes automatically. The markers highlight the conflicting sections from each branch.
❓ Troubleshoot
advanced2:00remaining
Resolving conflicts with multiple conflict markers
You see this in a file after a merge:
What is the correct way to resolve these conflicts?
<<<<<<< HEAD Line 1 ======= Line 1 modified >>>>>>> feature Some other text <<<<<<< HEAD Line 2 ======= Line 2 modified >>>>>>> feature
What is the correct way to resolve these conflicts?
Git
<<<<<<< HEAD Line 1 ======= Line 1 modified >>>>>>> feature Some other text <<<<<<< HEAD Line 2 ======= Line 2 modified >>>>>>> feature
Attempts:
2 left
💡 Hint
You must manually fix each conflict section and remove markers before committing.
✗ Incorrect
Each conflict section must be resolved by choosing or combining changes. After editing, all conflict markers must be removed to finalize the merge.
✅ Best Practice
advanced1:30remaining
Best practice to avoid long conflict markers in files
Which practice helps reduce the chance of large conflict markers appearing in files during merges?
Attempts:
2 left
💡 Hint
Frequent syncing helps keep branches aligned.
✗ Incorrect
Small, frequent commits and regularly pulling changes reduce divergence, minimizing conflicts and large conflict markers.
🧠 Conceptual
expert2:00remaining
Understanding nested conflict markers in Git
Is it possible for Git to produce nested conflict markers (conflict markers inside conflict markers) in a file after a merge? Why or why not?
Attempts:
2 left
💡 Hint
Think about how conflict markers are generated and edited.
✗ Incorrect
Git itself does not produce nested conflict markers. Nested markers can appear only if a user manually edits a conflicted file and adds markers inside existing ones.