Applying One Earlier Change on Another Branch
Cherry-picking applies the changes introduced by a chosen commit to the current line, ordinarily creating a new commit with a new parent.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace the dependency
A documentation fix may apply by itself to a maintenance branch. A bug fix that calls a helper added in an earlier commit needs that helper or an adaptation. Check the change diff before copying it.
Review ancestry and behavior
The new commit can differ from the original in both ID and content when conflicts required adapting it. A test on the maintenance branch verifies the behavior promised by the new snapshot.[1]
Bring one selected patch onto a different parent tree
Suppose a maintenance branch needs the validation fix from a commit on a feature branch. Applying that commit's change can produce a new commit with the maintenance tip as its parent. It need not bring neighboring feature commits. See reviewing a series of commits.
Source history A→B→C, fix occurs in C
Target branch X
Replay C's change on X → X→C′
C and C′ can have different IDs
Check whether the selected change depends on earlier work
A patch can apply cleanly and still call a helper that only exists on the source branch. Test the target snapshot. Record the source relationship when it helps future maintenance.