0
0
Gitdevops~20 mins

Cherry-picking multiple commits in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cherry-pick Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of cherry-picking a range of commits
You run the command git cherry-pick A1B2C3..D4E5F6 where A1B2C3 and D4E5F6 are commit hashes. What is the result?
AGit applies all commits after A1B2C3 up to and including D4E5F6 onto the current branch.
BGit applies commits from A1B2C3 to D4E5F6 including A1B2C3 onto the current branch.
CGit applies only the commit A1B2C3 onto the current branch.
DGit applies commits from D4E5F6 to A1B2C3 in reverse order onto the current branch.
Attempts:
2 left
💡 Hint
Remember how git ranges work with two commit hashes separated by two dots.
🧠 Conceptual
intermediate
2:00remaining
Understanding cherry-pick with multiple commits
Which statement correctly describes what happens when you cherry-pick multiple commits using git cherry-pick commit1 commit2 commit3?
AGit applies all commits simultaneously in parallel.
BGit applies only the last commit listed.
CGit applies the commits one by one in the order listed, stopping if a conflict occurs.
DGit applies the commits in reverse order from last to first.
Attempts:
2 left
💡 Hint
Think about how git handles conflicts during cherry-pick.
Troubleshoot
advanced
2:00remaining
Resolving cherry-pick conflict scenario
You cherry-pick three commits but get a conflict on the second commit. What is the correct next step to continue cherry-picking the remaining commits?
AResolve the conflict, stage the changes, then run <code>git cherry-pick --continue</code>.
BAbort the cherry-pick with <code>git cherry-pick --abort</code> and start over.
CIgnore the conflict and run <code>git cherry-pick --skip</code> to skip the second commit.
DReset the branch to before cherry-pick and manually apply commits.
Attempts:
2 left
💡 Hint
How does git expect you to handle conflicts during cherry-pick?
🔀 Workflow
advanced
2:00remaining
Cherry-picking multiple commits with a script
You want to cherry-pick commits abc123, def456, and ghi789 in that order using a single command. Which command achieves this?
Agit cherry-pick abc123,def456,ghi789
Bgit cherry-pick abc123..ghi789
Cgit cherry-pick abc123; git cherry-pick def456; git cherry-pick ghi789
Dgit cherry-pick abc123 def456 ghi789
Attempts:
2 left
💡 Hint
How does git accept multiple commits in one cherry-pick command?
Best Practice
expert
3:00remaining
Best practice for cherry-picking multiple commits with dependencies
You need to cherry-pick three commits where the third depends on changes in the first two. What is the best practice to avoid conflicts and maintain history?
ACherry-pick only the third commit since it includes all changes.
BCherry-pick the commits in the original order one by one, resolving conflicts as they come.
CSquash all three commits into one and cherry-pick the single combined commit.
DCherry-pick the commits in reverse order to apply dependencies first.
Attempts:
2 left
💡 Hint
Think about how dependencies between commits affect cherry-picking order.