Interview Q&A / Git & GitHub

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What does git cherry-pick do?

SHORT ANSWER

cherry-pick copies the changes of one chosen commit onto your current branch as a new commit. It lets you take a single fix without merging the whole branch it lives on.

Explain it simply

A friend's notes contain one useful formula among forty pages. You copy only that formula into your notes.

You checkout the branch that needs the change and run git cherry-pick <hash>. Git applies that commit's diff and creates a new commit with a new hash, the same message and author, and your name as committer. The two commits are copies, not links. It is ideal for backporting a bug fix to a release branch.

Example

bash
git switch release/2.1
git cherry-pick 4b5c6d7
# [release/2.1 a9f8e7d] Fix crash on empty cart
git log --oneline -1

What to say in the interview

"git cherry-pick applies the changes from a specific commit as a new commit on my current branch. I use it for backporting a hotfix to a release branch. The copy has a different hash and the commits are not linked."

#git#cherry-pick#commit

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.