bashintermediate
Git Cherry-Pick — Apply Specific Commits
Cherry-pick single, multiple, or ranges of commits from other branches without full merge.
bashPress ⌘/Ctrl + Shift + C to copy
# Cherry-pick a single commit
git cherry-pick abc1234
# Cherry-pick multiple specific commits
git cherry-pick abc1234 def5678 ghi9012
# Cherry-pick a range (exclusive start, inclusive end)
git cherry-pick abc1234..def5678
# Cherry-pick a range (inclusive both ends)
git cherry-pick abc1234^..def5678
# Cherry-pick without committing (stage changes only)
git cherry-pick --no-commit abc1234
# Cherry-pick from another remote
git fetch upstream
git cherry-pick upstream/main~3..upstream/main
# If conflicts occur:
git status # see conflicted files
# resolve conflicts in your editor, then:
git add .
git cherry-pick --continue
# Abort cherry-pick
git cherry-pick --abort
# Cherry-pick and sign-off
git cherry-pick -s abc1234 # adds Signed-off-by lineUse Cases
- Backporting hotfixes to release branches
- Picking features from long-lived branches
- Applying upstream fixes to forks
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
bashintermediate
Git Cherry-Pick Commits Example
Apply specific commits from one branch to another using cherry-pick with conflict resolution.
Best for: Backporting bug fixes to release branches
#git#cherry-pick
bashadvanced
Git Worktree — Work on Multiple Branches
Use git worktree to check out multiple branches simultaneously in separate directories.
Best for: Reviewing PRs without stashing current work
#git#worktree
bashbeginner
Git Remote Prune and Branch Cleanup
Clean up stale remote-tracking branches and local branches that have been merged or deleted upstream.
Best for: Keeping local repository tidy
#git#cleanup
bashbeginner
Git Reset — Soft, Mixed, and Hard Explained
Understand the three git reset modes and when to use each for undoing commits safely.
Best for: Undoing accidental commits before pushing
#git#reset