1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.4.5" />
7 <title>git-cherry-pick(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-cherry-pick(
1) Manual Page
409 <div class=
"sectionbody">
411 Apply the changes introduced by some existing commits
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git cherry-pick
</em> [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
<commit
>…</div>
419 <div class=
"verseblock-attribution">
422 <h2 id=
"_description">DESCRIPTION
</h2>
423 <div class=
"sectionbody">
424 <div class=
"paragraph"><p>Given one or more existing commits, apply the change each one
425 introduces, recording a new commit for each. This requires your
426 working tree to be clean (no modifications from the HEAD commit).
</p></div>
427 <div class=
"paragraph"><p>When it is not obvious how to apply a change, the following
429 <div class=
"olist arabic"><ol class=
"arabic">
432 The current branch and
<tt>HEAD
</tt> pointer stay at the last commit
438 The
<tt>CHERRY_PICK_HEAD
</tt> ref is set to point at the commit that
439 introduced the change that is difficult to apply.
444 Paths in which the change applied cleanly are updated both
445 in the index file and in your working tree.
450 For conflicting paths, the index file records up to three
451 versions, as described in the
"TRUE MERGE" section of
452 <a href=
"git-merge.html">git-merge(
1)
</a>. The working tree files will include
453 a description of the conflict bracketed by the usual
454 conflict markers
<tt><<<<<<<</tt> and
<tt>>>>>>>></tt>.
459 No other modifications are made.
463 <div class=
"paragraph"><p>See
<a href=
"git-merge.html">git-merge(
1)
</a> for some hints on resolving such
466 <h2 id=
"_options">OPTIONS
</h2>
467 <div class=
"sectionbody">
468 <div class=
"dlist"><dl>
470 <commit
>…
474 Commits to cherry-pick.
475 For a more complete list of ways to spell commits, see
476 <a href=
"gitrevisions.html">gitrevisions(
7)
</a>.
477 Sets of commits can be passed but no traversal is done by
478 default, as if the
<em>--no-walk
</em> option was specified, see
479 <a href=
"git-rev-list.html">git-rev-list(
1)
</a>.
490 With this option,
<em>git cherry-pick
</em> will let you edit the commit
491 message prior to committing.
499 When recording the commit, append a line that says
500 "(cherry picked from commit …)" to the original commit
501 message in order to indicate which commit this change was
502 cherry-picked from. This is done only for cherry
503 picks without conflicts. Do not use this option if
504 you are cherry-picking from your private branch because
505 the information is useless to the recipient. If on the
506 other hand you are cherry-picking between two publicly
507 visible branches (e.g. backporting a fix to a
508 maintenance branch for an older release from a
509 development branch), adding this information can be
518 It used to be that the command defaulted to do
<tt>-x
</tt>
519 described above, and
<tt>-r
</tt> was to disable it. Now the
520 default is not to do
<tt>-x
</tt> so this option is a no-op.
527 --mainline parent-number
531 Usually you cannot cherry-pick a merge because you do not know which
532 side of the merge should be considered the mainline. This
533 option specifies the parent number (starting from
1) of
534 the mainline and allows cherry-pick to replay the change
535 relative to the specified parent.
546 Usually the command automatically creates a sequence of commits.
547 This flag applies the changes necessary to cherry-pick
548 each named commit to your working tree and the index,
549 without making any commit. In addition, when this
550 option is used, your index does not have to match the
551 HEAD commit. The cherry-pick is done against the
552 beginning state of your index.
554 <div class=
"paragraph"><p>This is useful when cherry-picking more than one commits'
555 effect to your index in a row.
</p></div>
565 Add Signed-off-by line at the end of the commit message.
573 If the current HEAD is the same as the parent of the
574 cherry-pick
’ed commit, then a fast forward to this commit will
579 --strategy=
<strategy
>
583 Use the given merge strategy. Should only be used once.
584 See the MERGE STRATEGIES section in
<a href=
"git-merge.html">git-merge(
1)
</a>
592 --strategy-option=
<option
>
596 Pass the merge strategy-specific option through to the
597 merge strategy. See
<a href=
"git-merge.html">git-merge(
1)
</a> for details.
602 <h2 id=
"_examples">EXAMPLES
</h2>
603 <div class=
"sectionbody">
604 <div class=
"dlist"><dl>
606 <tt>git cherry-pick master
</tt>
610 Apply the change introduced by the commit at the tip of the
611 master branch and create a new commit with this change.
615 <tt>git cherry-pick ..master
</tt>
618 <tt>git cherry-pick ^HEAD master
</tt>
622 Apply the changes introduced by all commits that are ancestors
623 of master but not of HEAD to produce new commits.
627 <tt>git cherry-pick master
~4 master
~2</tt>
631 Apply the changes introduced by the fifth and third last
632 commits pointed to by master and create
2 new commits with
637 <tt>git cherry-pick -n master~
1 next
</tt>
641 Apply to the working tree and the index the changes introduced
642 by the second last commit pointed to by master and by the last
643 commit pointed to by next, but do not create any commit with
648 <tt>git cherry-pick --ff ..next
</tt>
652 If history is linear and HEAD is an ancestor of next, update
653 the working tree and advance the HEAD pointer to match next.
654 Otherwise, apply the changes introduced by those commits that
655 are in next but not HEAD to the current branch, creating a new
656 commit for each new change.
660 <tt>git rev-list --reverse master -- README | git cherry-pick -n --stdin
</tt>
664 Apply the changes introduced by all commits on the master
665 branch that touched README to the working tree and index,
666 so the result can be inspected and made into a single new
671 <div class=
"paragraph"><p>The following sequence attempts to backport a patch, bails out because
672 the code the patch applies to has changed too much, and then tries
673 again, this time exercising more care about matching up context lines.
</p></div>
674 <div class=
"listingblock">
675 <div class=
"content">
676 <pre><tt>$ git cherry-pick topic^
<b><1></b>
677 $ git diff
<b><2></b>
678 $ git reset --merge ORIG_HEAD
<b><3></b>
679 $ git cherry-pick -Xpatience topic^
<b><4></b></tt></pre>
681 <div class=
"colist arabic"><ol>
684 apply the change that would be shown by
<tt>git show topic^
</tt>.
685 In this example, the patch does not apply cleanly, so
686 information about the conflict is written to the index and
687 working tree and no new commit results.
692 summarize changes to be reconciled
697 cancel the cherry-pick. In other words, return to the
698 pre-cherry-pick state, preserving any local modifications you had in
704 try to apply the change introduced by
<tt>topic^
</tt> again,
705 spending extra time to avoid mistakes based on incorrectly matching
711 <h2 id=
"_see_also">SEE ALSO
</h2>
712 <div class=
"sectionbody">
713 <div class=
"paragraph"><p><a href=
"git-revert.html">git-revert(
1)
</a></p></div>
715 <h2 id=
"_git">GIT
</h2>
716 <div class=
"sectionbody">
717 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
720 <div id=
"footer-text">
721 Last updated
2011-
08-
05 00:
04:
52 UTC