Cherry Picking

Download git eBook

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.

Related Examples

Stats

2114 Contributors: 11
Friday, June 9, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook