0
0
Gitdevops~20 mins

Why merging combines work in Git - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of Merging
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why does git merge combine work?

Imagine two friends writing a story separately on different pages. When they put their pages together, why does git merge combine their work?

ABecause it creates a new snapshot that includes changes from both friends' pages.
BBecause it deletes one friend's work and keeps only the other's.
CBecause it copies one friend's page over the other without changes.
DBecause it ignores all changes and keeps the original story only.
Attempts:
2 left
💡 Hint

Think about how git keeps track of changes from different sources.

💻 Command Output
intermediate
2:00remaining
Output of git merge with no conflicts

What is the output of the command git merge feature when the feature branch has new commits that do not conflict with the current branch?

Git
git merge feature
A
Updating abc1234..def5678
Fast-forward
BAutomatic merge failed; fix conflicts and then commit the result.
Cerror: You have not concluded your merge (MERGE_HEAD exists).
DAlready up to date.
Attempts:
2 left
💡 Hint

Think about what happens when the merge can be done without conflicts.

Troubleshoot
advanced
3:00remaining
Resolving merge conflicts

You run git merge feature and get a conflict message. What is the correct next step to combine work?

Git
git merge feature
ADelete the conflicting files and run <code>git commit</code>.
BEdit the conflicting files to fix conflicts, then run <code>git add</code> and <code>git commit</code>.
CRun <code>git push</code> immediately to overwrite remote.
DRun <code>git merge --abort</code> to cancel and lose all changes.
Attempts:
2 left
💡 Hint

Conflicts need manual fixing before completing the merge.

🔀 Workflow
advanced
3:00remaining
Merging multiple branches workflow

You have branches dev, feature1, and feature2. To combine work from both features into dev, which sequence is correct?

A2,1,3,4
B1,3,2,4
C3,2,1,4
D1,2,3,4
Attempts:
2 left
💡 Hint

Start by switching to the target branch before merging others.

Best Practice
expert
3:00remaining
Why prefer merging over overwriting work?

Why is it better to use git merge to combine work instead of manually copying files and committing?

ABecause git merge deletes old files automatically.
BBecause manually copying files is faster and safer.
CBecause git merge preserves history and tracks changes from all contributors.
DBecause manual copying avoids merge conflicts.
Attempts:
2 left
💡 Hint

Think about how git helps keep track of who changed what and when.