Git Cherry Picking

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

A cherry-pick takes the patch that was introduced in a commit and tries to reapply it on the branch you’re currently on.

Source: Git SCM Book

Syntax

  • git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[key-id]] commit...
  • git cherry-pick --continue
  • git cherry-pick --quit
  • git cherry-pick --abort

Parameters

ParametersDetails
-e, --editWith this option, git cherry-pick will let you edit the commit message prior to committing.
-xWhen recording the commit, append a line that says "(cherry picked from commit …​)" to the original commit message in order to indicate which commit this change was cherry-picked from. This is done only for cherry picks without conflicts.
--ffIf the current HEAD is the same as the parent of the cherry-pick’ed commit, then a fast forward to this commit will be performed.
--continueContinue the operation in progress using the information in .git/sequencer. Can be used to continue after resolving conflicts in a failed cherry-pick or revert.
--quitForget about the current operation in progress. Can be used to clear the sequencer state after a failed cherry-pick or revert.
--abortCancel the operation and return to the pre-sequence state.


Got any Git Question?