bashintermediate
Git Cherry-Pick Commits Example
Apply specific commits from one branch to another using cherry-pick with conflict resolution.
bashPress ⌘/Ctrl + Shift + C to copy
# Cherry-pick a single commit by hash
git cherry-pick abc1234
# Cherry-pick multiple commits
git cherry-pick abc1234 def5678 ghi9012
# Cherry-pick a range of commits (exclusive start)
git cherry-pick abc1234..ghi9012
# Cherry-pick without committing (stage changes only)
git cherry-pick --no-commit abc1234
# Cherry-pick from another branch
git checkout main
git cherry-pick feature/hotfix~2
# If conflicts occur:
git add .
git cherry-pick --continue
# Abort cherry-pick
git cherry-pick --abort
# Cherry-pick and edit the commit message
git cherry-pick -e abc1234
# Find the commit hash to cherry-pick
git log --oneline other-branch | head -10Use Cases
- Backporting bug fixes to release branches
- Selectively applying features across branches
- Hotfix deployment without full merge
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
bashintermediate
Git Cherry-Pick — Apply Specific Commits
Cherry-pick single, multiple, or ranges of commits from other branches without full merge.
Best for: Backporting hotfixes to release branches
#git#cherry-pick
bashintermediate
Git Rebase Workflow Example
Step-by-step git rebase workflow to keep feature branches up to date with main branch cleanly.
Best for: Keeping feature branches linear with main
#git#rebase
bashadvanced
Git Worktree for Multiple Branches
Work on multiple branches simultaneously using git worktree without stashing or switching.
Best for: Reviewing PRs while working on a feature
#git#worktree
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