Git Cherry-Pick: Copy One Commit (Not a Whole Branch)

Suman SharmaSuman Sharma

Git Cherry-Pick: Copy One Commit (Not a Whole Branch)

Cherry-pick applies one specific commit from another branch onto your current branch.

You don’t merge the whole branch. You steal one snapshot.

Cherry-picking a single commit in Git

The command

git switch main git cherry-pick <commit-sha>

When it’s perfect

  • a hotfix exists on a feature branch and production needs only that fix
  • you accidentally committed on the wrong branch and need one commit elsewhere
  • backporting a single change to a release branch

Next

If cherry-pick causes conflicts, resolve them like any other merge conflict:

Contact

Get in Touch

Want to call me? book a call and I'll respond in the available time slot. I will ignore all soliciting.