Interview Q&A / Git & GitHub

IntermediateQuick answer1 min readUpdated 3 Oct 2026

Is cherry-pick the same as rebase for moving one commit?

SHORT ANSWER

They are close, but cherry-pick copies a commit and leaves the original where it is, while rebase moves a whole sequence of your branch's commits and abandons the originals.

Explain it simply

Internally, rebase is just a loop of cherry-picks followed by moving the branch label. The difference is what you point it at.

Cherry-pick: choose individual commits, the original branch is unchanged, so the change ends up on two branches. Rebase: replay all commits unique to your branch on a new base, and the branch name moves to the new copies. If you want the work in two places, cherry-pick. If you want to relocate a branch, rebase.

Example

bash
git switch main && git cherry-pick feature~1   # copy one commit
git switch feature && git rebase main          # move the whole branch

What to say in the interview

"Rebase effectively cherry-picks every commit of my branch onto a new base and then moves the branch. Cherry-pick copies selected commits and leaves the source branch alone, so the same change then lives in two places."

#git#cherry-pick#rebase

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.