Does "git cherry-pick" Remove the Commit From Source Branch?

When you cherry-pick a git commit, the commit in the source/origin branch is not removed or affected in any way. Consider, for example, the following:

# 1: switch to the target branch
git switch foo

# 2: cherry-pick commit and apply it to target branch
git cherry-pick 3ba53ff050ef253058088eff5

Cherry-picking git commit would copy over the commit's delta, and create a new commit from it in the target branch (without affecting the source branch):

git status

# output:
# On branch foo
# Your branch is ahead of 'origin/foo' by 1 commit.
#  (use "git push" to publish your local commits)

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.