Cherry-pick applies the change introduced by an existing commit onto the current branch. It is useful for backporting a fix or moving a narrowly scoped change without merging an entire branch.
Confirm the source and destination
Before cherry-picking, inspect the commit, its parent, and the branch you are on. A commit may depend on earlier changes that are not present on the destination branch. Applying it alone can produce a build that fails or behavior that is incomplete.
Preserve traceability
For changes copied between maintenance branches, record the original commit reference in the resulting history when team policy supports it. Keep issue and release references consistent.
Handle conflicts and duplicates
Resolve conflicts by understanding the target branch's version of the code. Before applying a commit, check whether an equivalent fix has already been introduced through another merge or backport. Repeatedly applying similar commits can create duplicate changes.
Checklist
- Inspect commit dependencies before transfer.
- Confirm the destination branch.
- Check whether the change already exists.
- Resolve conflicts with target-branch context.
- Record the original change reference.