0
0
Gitdevops~20 mins

Merge commit creation in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Merge Commit Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of a successful merge commit?
You run git merge feature-branch on your main branch. The merge completes without conflicts and creates a merge commit. What will git log --oneline -1 show as the commit message?
ARevert "feature-branch"
BInitial commit
CMerge branch 'feature-branch'
DFix typo in README
Attempts:
2 left
💡 Hint
Think about the default message git uses when creating a merge commit.
🧠 Conceptual
intermediate
2:00remaining
What happens during a merge commit creation?
Which of the following best describes what a merge commit does in git?
AIt combines the histories of two branches by creating a new commit with two parents.
BIt deletes the source branch after merging.
CIt creates a new branch from the current commit.
DIt rewrites the commit history of the target branch.
Attempts:
2 left
💡 Hint
Think about how git tracks the relationship between branches after merging.
🔀 Workflow
advanced
2:00remaining
Identify the correct git commands to create a merge commit
You want to merge the branch feature into main and create a merge commit even if the merge could be fast-forwarded. Which sequence of commands will do this?
A
git checkout main

git merge feature
B
git checkout main

git merge --no-ff feature
C
git checkout feature

git merge main
Dgit merge --no-ff main feature
Attempts:
2 left
💡 Hint
Remember to be on the target branch before merging and use the option to force a merge commit.
Troubleshoot
advanced
2:00remaining
Why does git refuse to create a merge commit?
You run git merge feature on main, but git fast-forwards instead of creating a merge commit. You want a merge commit. What is the reason?
AGit does not support merge commits.
BThe feature branch has conflicts that prevent a merge commit.
CYou are not on the main branch when running the merge.
DThe feature branch is ahead and main has no new commits, so git fast-forwards by default.
Attempts:
2 left
💡 Hint
Think about when git chooses to fast-forward merges.
Best Practice
expert
2:00remaining
What is the best practice for merge commit messages?
When creating a merge commit manually, which message style is recommended to keep history clear and useful?
AUse the default message like "Merge branch 'feature'" and add a short description of changes.
BWrite only the branch name without any description.
CUse a generic message like "Update" for all merges.
DDelete the commit message to keep history clean.
Attempts:
2 left
💡 Hint
Think about clarity and usefulness for future readers of the history.