Interview Q&A / Git & GitHub

IntermediateQuick answer1 min readUpdated 3 Oct 2026

When is cherry-pick a bad idea?

SHORT ANSWER

Overusing it creates duplicate commits with different hashes, which later cause confusing conflicts when the branches are merged. Prefer merging or rebasing when you want the whole branch.

Explain it simply

Photocopying a page is fine once. If you photocopy a dozen pages and later also staple the original book in, you have repeats everywhere.

A cherry-picked commit is a copy, so when the source branch is eventually merged, Git may see the same change twice. Often it detects the match and moves on, but when surrounding code changed it raises conflicts that are hard to read. Good uses are hotfix backports and rescuing one commit from an abandoned branch. If you find yourself picking many commits, a merge or rebase is the better tool.

Example

bash
git log --oneline --cherry-mark main...feature
# = same change on both sides, + only in feature

What to say in the interview

"Cherry-pick makes duplicate commits with different hashes, which can cause confusing conflicts later. I limit it to backports and one-off rescues, and use merge or rebase for whole branches."

#git#cherry-pick#best-practice

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.