Workflows
Backporting with Cherry-pick
Backport precise fixes onto maintenance branches without merging an entire feature branch.
- Teams turning commands into repeatable routines
- Readers who need sequencing, branch, and sync discipline
- Basic understanding of fetch, pull, push, and branches
- A sense of how and why branches diverge
- Copying a workflow without checking branch state
- Choosing the wrong integration path on shared branches
Citations & Further Reading
- Git cherry pick [Official]
- Git branch [Official]
- git-scm.com — Git log [Official]
What you will learn
- Understand the core purpose of Backporting with Cherry-pick
- Master the basic usage and common options of Backporting with Cherry-pick
- Backport precise fixes onto maintenance branches without merging an entire feature branch.
- Understand key concepts: Where this workflow fits
- Know when to use this feature and when to avoid it
Start with a problem
Your team is collaborating on a project, branches are growing, merges are becoming more frequent — but there's no stable collaboration rhythm. Everyone syncs code their own way, and conflicts are piling up.
Where this workflow fits
When a fix already landed on main but an older maintenance line still needs it, the usual problem is:
"I need this one repair, not the whole branch history."
That is when cherry-pick is a strong fit.
Suggested sequence
1. identify the exact commit
git log --oneline --decorate main
The first risk in backporting is not conflict. It is choosing the wrong commit.
2. switch to the maintenance branch and cherry-pick
git switch release/2.3
git cherry-pick <commit-sha>
3. validate the resulting diff and tests
git show --stat --oneline HEAD
git diff --stat origin/release/2.3...
Do not stop at "the command succeeded." Confirm the resulting change still makes sense on the older branch.
Why this order is safer
Backporting works best when the order is fixed:
- confirm the right commit
- confirm the target maintenance branch
- confirm the fix still stands alone after the pick
Common mistakes
- cherry-picking before checking dependency commits
- backporting multiple commits without thinking through order
- assuming a successful cherry-pick means the fix is release-ready
Special cases
- if the fix depends on earlier refactors, a single cherry-pick may not be enough
- if the old branch has different config or schema expectations, validate in branch context
- if multiple maintenance lines need the same repair, verify one branch before repeating the flow
Try it yourself
- Practice the backport-with-cherry-pick command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: