Challenge - 5 Problems
Cherry-Pick Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Output of cherry-pick with a valid commit hash
What is the output when you run
git cherry-pick 1a2b3c4 on a branch where the commit 1a2b3c4 exists and applies cleanly?Attempts:
2 left
💡 Hint
Cherry-pick applies the commit if it can without conflicts.
✗ Incorrect
When the commit exists and applies cleanly, git cherry-pick outputs 'Finished one cherry-pick.'
🧠 Conceptual
intermediate1:30remaining
Understanding cherry-pick behavior on conflicts
What happens if you run
git cherry-pick abcdef1 and the changes conflict with your current branch?Attempts:
2 left
💡 Hint
Cherry-pick stops when conflicts occur.
✗ Incorrect
Git stops the cherry-pick process and asks you to resolve conflicts manually before continuing.
🔀 Workflow
advanced2:00remaining
Correct sequence to cherry-pick and resolve conflicts
Arrange the steps in the correct order to cherry-pick a commit and resolve conflicts if they occur.
Attempts:
2 left
💡 Hint
Cherry-pick stops on conflicts, you fix them, stage changes, then continue.
✗ Incorrect
The correct workflow is to cherry-pick, fix conflicts, stage resolved files, then continue cherry-pick.
❓ Troubleshoot
advanced1:30remaining
Error when cherry-picking a non-existent commit
What error message do you get if you run
git cherry-pick deadbeef but the commit hash deadbeef does not exist in your repository?Attempts:
2 left
💡 Hint
Git cannot find the commit hash in the repo.
✗ Incorrect
Git reports 'fatal: bad revision' when the commit hash is invalid or missing.
✅ Best Practice
expert2:00remaining
Best practice to avoid duplicate commits when cherry-picking
Which practice helps avoid duplicate commits when cherry-picking a commit that might already be in your branch history?
Attempts:
2 left
💡 Hint
Tracking original commit helps identify duplicates.
✗ Incorrect
Using 'git cherry-pick -x' adds the original commit hash to the commit message, helping track duplicates.