Resolve, Continue or Abort a Cherry-Pick
A conflict is a decision
Suppose main fixes an ambiguous note to Water every 3 days, while release already says Water every 2. The release requirement is a two-day interval with a clear unit. In scenario B of the guide, cherry-pick stops because both sides edit the same line. HEAD remains at the last successful commit; CHERRY_PICK_HEAD identifies the stopped source commit. Other paths may already have changed.
Read before editing
Run the following commands only in scenario B. A nonzero exit from cherry-pick is expected. The index has stage 1 (base), 2 (current release), and 3 (picked side) for notes.txt. Inspect both intended changes, not just conflict markers. The command git show :2:notes.txt reads stage 2.
git cherry-pick fix-sourcegit status --shortgit show CHERRY_PICK_HEADgit ls-files -ugit show :2:notes.txtgit show :3:notes.txtResolve and continue
For this specific requirement, write Water every 2 days. Stage the resolved file and inspect the staged diff. Check for remaining unmerged entries, then continue. If an editor opens, review the commit message and save it. The result should preserve the release-specific interval and add the unit. The original source commit stays unchanged.
printf "Water every 2 days\n" > notes.txtgit add -- notes.txtgit diff --cachedgit diff --cached --checkgit ls-files -ugit cherry-pick --continuegit show HEAD:notes.txtCancel or omit deliberately
In a separate copy of scenario B, stop at the same conflict and run git cherry-pick --abort to return to the pre-sequence state. In a multi-commit sequence this also rolls back earlier successful picks in that sequence. --skip instead omits the current commit and proceeds with remaining commits. --quit forgets operation state without restoring the previous snapshot; do not use it as a synonym for abort. Preserve valuable resolution edits separately before cancellation. Practice: which option is appropriate if a fix is still required? Resolve and continue, not skip.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Resolve, Continue or Abort a Cherry-Pick — knowledge check
Reason about selective integration and backport verification.
What identifies the stopped source commit?
What does index stage 2 represent here?
What follows editing the resolved file?
What does abort do to a sequence?
What does skip do?