0
0
Gitdevops~5 mins

Merge conflicts why they happen in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a merge conflict in Git?
A merge conflict happens when Git cannot automatically combine changes from two branches because the same part of a file was changed differently in each branch.
Click to reveal answer
beginner
Why do merge conflicts happen?
They happen because two or more people changed the same lines in a file or when changes overlap and Git can't decide which change to keep.
Click to reveal answer
intermediate
How can you reduce the chance of merge conflicts?
By communicating with your team, pulling changes often, and working on different parts of the code to avoid editing the same lines at the same time.
Click to reveal answer
beginner
What does Git show when a merge conflict occurs?
Git marks the conflicting parts in the file with special symbols like <<<<<<<, =======, and >>>>>>> so you can see both versions and decide how to fix it.
Click to reveal answer
intermediate
Can merge conflicts happen with binary files?
Yes, but Git cannot show differences for binary files, so conflicts must be resolved by choosing one version or using special tools.
Click to reveal answer
What causes a merge conflict in Git?
AFiles are deleted in one branch only
BBranches have different names
CBranches are merged in the same order
DTwo branches change the same lines differently
Which symbol does Git use to mark conflicts in files?
A#####, $$$$$$, @@@@@@
B<<<<<<<, =======, >>>>>>>
C*****, ++++++, -----
D%%%%%%, &&&&&&, !!!!!
How can you avoid merge conflicts?
AWork on different parts of the code and pull changes often
BNever update your branch
CDelete files before merging
DMerge without checking changes
What should you do when a merge conflict occurs?
AManually edit the file to fix conflicts
BDelete the file
CIgnore the conflict and commit
DRestart Git
Can Git automatically resolve all merge conflicts?
AOnly for binary files
BYes, always
CNo, some conflicts need manual fixing
DOnly if branches are identical
Explain why merge conflicts happen in Git and how you can recognize them.
Think about what happens when two people edit the same sentence differently.
You got /3 concepts.
    Describe strategies to reduce merge conflicts when working in a team.
    How can you avoid stepping on each other's toes in coding?
    You got /3 concepts.