0
0
Gitdevops~20 mins

Reading conflict markers in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Conflict Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1: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
ANo content, conflict markers only
BLine A
CLine A and Line B combined
DLine B
Attempts:
2 left
💡 Hint
The content between <<<<<<< HEAD and ======= is from the current branch.
💻 Command Output
intermediate
1:30remaining
What does Git show after a merge conflict?
After running 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 feature
AThe feature branch was deleted
BThe merge was successful with no conflicts
CThe file has conflicting changes between current branch and feature branch
DThe file was unchanged
Attempts:
2 left
💡 Hint
Conflict markers appear only when Git cannot automatically merge changes.
Troubleshoot
advanced
2:00remaining
Resolving conflicts with multiple conflict markers
You see this in a file after a merge:
<<<<<<< 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
AEdit each conflict section to choose or combine changes, then remove all conflict markers
BDelete the entire file and recreate it
CIgnore the conflict markers and commit the file as is
DRun 'git reset --hard' to discard all changes
Attempts:
2 left
💡 Hint
You must manually fix each conflict section and remove markers before committing.
Best Practice
advanced
1: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?
AAlways delete conflicting files and recreate them
BAvoid committing code for long periods
CUse only one branch for all development
DCommit small, frequent changes and pull updates often
Attempts:
2 left
💡 Hint
Frequent syncing helps keep branches aligned.
🧠 Conceptual
expert
2: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?
AYes, but only if manual edits introduce nested markers
BYes, Git can nest conflict markers if multiple merges overlap
CNo, Git never nests conflict markers; each conflict is separate and flat
DNo, Git removes all conflict markers automatically
Attempts:
2 left
💡 Hint
Think about how conflict markers are generated and edited.