Skip to content

Git Cherry-pick

Git

Apply specific commits from one branch to another with cherry-pick.

Official Site
01

Overview

Cherry-pick applies a commit from another branch onto your current branch. Useful for hotfixes or backporting. Creates a new commit (different hash). Can conflict. Avoid for regular feature work (use merge/rebase instead).

bash
git cherry-pick abc123  # apply commit
git cherry-pick abc123..def456  # range
git cherry-pick -x abc123  # add source ref
git cherry-pick --abort  # cancel
# Multiple commits
git cherry-pick a1 b2 c3
02

Best Practices

Use for hotfixes and backports. Avoid for regular features (use merge). -x records origin. May conflict (resolve normally). Cherry-picking can create duplicate commits if later merged. Use sparingly.)

Ready to try Git Cherry-pick?

Visit the official site for the latest version and full documentation.

Visit Git Cherry-pick