0
0
Gitdevops~20 mins

Resolving merge conflicts in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Merge Conflict Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output after a failed merge due to conflicts?
You run git merge feature-branch but there are conflicts. What message does Git show?
A
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Automatic merge failed; fix conflicts and then commit the result.
BMerge made by the 'recursive' strategy.
CAlready up to date.
Dfatal: Not a git repository (or any of the parent directories): .git
Attempts:
2 left
💡 Hint
Think about what Git says when it cannot automatically merge files.
🔀 Workflow
intermediate
2:00remaining
Correct sequence to resolve a merge conflict
Which sequence of commands correctly resolves a merge conflict and completes the merge?
A3,2,1,4
B2,1,3,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
Start by checking status, then fix files, stage them, and commit.
Troubleshoot
advanced
2:00remaining
Why does 'git commit' fail after resolving conflicts?
You resolved all conflicts and staged the files, but git commit still fails with the message: error: Committing is not possible because you have unmerged files. What is the most likely cause?
AYour repository is corrupted and needs to be recloned.
BYou need to run <code>git merge --continue</code> instead of <code>git commit</code>.
CYou forgot to stage all conflicted files after resolving conflicts.
DYou must delete the conflicted files before committing.
Attempts:
2 left
💡 Hint
Think about what Git requires before committing a merge.
🧠 Conceptual
advanced
2:00remaining
Understanding conflict markers in files
What do the conflict markers <<<<<<<, =======, and >>>>>>> in a file indicate?
AThey mark the conflicting sections from the current branch and the branch being merged.
BThey are comments added by Git to explain the merge process.
CThey indicate lines that were deleted during the merge.
DThey are placeholders for unresolved binary files.
Attempts:
2 left
💡 Hint
Think about how Git shows differences inside a conflicted file.
Best Practice
expert
2:00remaining
Best practice to avoid complex merge conflicts
Which practice helps reduce the chance of complex merge conflicts in a team working on the same codebase?
AAvoid committing changes until your feature is fully complete.
BFrequently pull and merge changes from the main branch into your feature branch.
CUse force push to overwrite remote branches when conflicts occur.
DWork on large features in a single long-lived branch without syncing.
Attempts:
2 left
💡 Hint
Think about keeping your branch up to date with others.