Recall & Review
beginner
What does the
git cherry-pick command do?It applies the changes introduced by a specific commit from one branch onto the current branch.
Click to reveal answer
beginner
How do you cherry-pick a single commit with hash
abc123?Use the command
git cherry-pick abc123 while on the target branch.Click to reveal answer
intermediate
What should you do if a conflict occurs during
git cherry-pick?Manually resolve the conflicts, then run
git cherry-pick --continue to finish.Click to reveal answer
intermediate
Can
git cherry-pick be used to apply multiple commits at once?Yes, by specifying a range of commits or multiple commit hashes, but for a single commit, just use its hash.
Click to reveal answer
advanced
What happens if you cherry-pick a commit that is already in the current branch?
Git typically aborts because it would result in an empty commit (changes already present), unless
--allow-empty is used to create a duplicate with a new hash, which can cause confusion.Click to reveal answer
What is the purpose of
git cherry-pick?✗ Incorrect
git cherry-pick copies changes from a specific commit to your current branch.
Which command applies commit
abc123 to your current branch?✗ Incorrect
git cherry-pick abc123 applies that commit's changes to your branch.
If a conflict happens during cherry-pick, what is the next step?
✗ Incorrect
You must fix conflicts and then continue the cherry-pick process.
Can
git cherry-pick create duplicate commits?✗ Incorrect
Cherry-pick creates a new commit with a new hash. If the changes already exist, it aborts (empty commit) unless --allow-empty is used.
Which command aborts a cherry-pick in progress?
✗ Incorrect
git cherry-pick --abort stops the cherry-pick and resets to the previous state.
Explain how to cherry-pick a single commit from another branch and what to do if conflicts occur.
Think about the steps from switching branches to finishing the cherry-pick.
You got /4 concepts.
Describe the risks or issues that can happen when cherry-picking commits.
Consider what happens if the same changes exist or conflicts arise.
You got /3 concepts.