Skip to content

Commit

Permalink
Merge branch 'cc/cherry-pick-series'
Browse files Browse the repository at this point in the history
* cc/cherry-pick-series:
  Documentation/revert: describe passing more than one commit
  Documentation/cherry-pick: describe passing more than one commit
  revert: add tests to check cherry-picking many commits
  revert: allow cherry-picking more than one commit
  revert: change help_msg() to take no argument
  revert: refactor code into a do_pick_commit() function
  revert: use run_command_v_opt() instead of execv_git_cmd()
  revert: cleanup code for -x option
  • Loading branch information
Junio C Hamano committed Jun 22, 2010
2 parents a214afd + 86c7bb4 commit 8c7da86
Show file tree
Hide file tree
Showing 4 changed files with 264 additions and 66 deletions.
64 changes: 53 additions & 11 deletions Documentation/git-cherry-pick.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@ git-cherry-pick(1)

NAME
----
git-cherry-pick - Apply the change introduced by an existing commit
git-cherry-pick - Apply the changes introduced by some existing commits

SYNOPSIS
--------
'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>
'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...

DESCRIPTION
-----------
Given one existing commit, apply the change the patch introduces, and record a
new commit that records it. This requires your working tree to be clean (no
modifications from the HEAD commit).

Given one or more existing commits, apply the change each one
introduces, recording a new commit for each. This requires your
working tree to be clean (no modifications from the HEAD commit).

OPTIONS
-------
<commit>::
Commit to cherry-pick.
<commit>...::
Commits to cherry-pick.
For a more complete list of ways to spell commits, see the
"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
Sets of commits can be passed but no traversal is done by
default, as if the '--no-walk' option was specified, see
linkgit:git-rev-list[1].

-e::
--edit::
Expand Down Expand Up @@ -55,10 +59,10 @@ OPTIONS

-n::
--no-commit::
Usually the command automatically creates a commit.
This flag applies the change necessary to cherry-pick
the named commit to your working tree and the index,
but does not make the commit. In addition, when this
Usually the command automatically creates a sequence of commits.
This flag applies the changes necessary to cherry-pick
each named commit to your working tree and the index,
without making any commit. In addition, when this
option is used, your index does not have to match the
HEAD commit. The cherry-pick is done against the
beginning state of your index.
Expand All @@ -75,6 +79,40 @@ effect to your index in a row.
cherry-pick'ed commit, then a fast forward to this commit will
be performed.

EXAMPLES
--------
git cherry-pick master::

Apply the change introduced by the commit at the tip of the
master branch and create a new commit with this change.

git cherry-pick ..master::
git cherry-pick ^HEAD master::

Apply the changes introduced by all commits that are ancestors
of master but not of HEAD to produce new commits.

git cherry-pick master\~4 master~2::

Apply the changes introduced by the fifth and third last
commits pointed to by master and create 2 new commits with
these changes.

git cherry-pick -n master~1 next::

Apply to the working tree and the index the changes introduced
by the second last commit pointed to by master and by the last
commit pointed to by next, but do not create any commit with
these changes.

git cherry-pick --ff ..next::

If history is linear and HEAD is an ancestor of next, update
the working tree and advance the HEAD pointer to match next.
Otherwise, apply the changes introduced by those commits that
are in next but not HEAD to the current branch, creating a new
commit for each new change.

Author
------
Written by Junio C Hamano <gitster@pobox.com>
Expand All @@ -83,6 +121,10 @@ Documentation
--------------
Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.

SEE ALSO
--------
linkgit:git-revert[1]

GIT
---
Part of the linkgit:git[1] suite
51 changes: 37 additions & 14 deletions Documentation/git-revert.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ git-revert(1)

NAME
----
git-revert - Revert an existing commit
git-revert - Revert some existing commits

SYNOPSIS
--------
'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>...

DESCRIPTION
-----------
Given one existing commit, revert the change the patch introduces, and record a
new commit that records it. This requires your working tree to be clean (no
modifications from the HEAD commit).

Note: 'git revert' is used to record a new commit to reverse the
effect of an earlier commit (often a faulty one). If you want to
Given one or more existing commits, revert the changes that the
related patches introduce, and record some new commits that record
them. This requires your working tree to be clean (no modifications
from the HEAD commit).

Note: 'git revert' is used to record some new commits to reverse the
effect of some earlier commits (often only a faulty one). If you want to
throw away all uncommitted changes in your working directory, you
should see linkgit:git-reset[1], particularly the '--hard' option. If
you want to extract specific files as they were in another commit, you
Expand All @@ -26,10 +28,13 @@ both will discard uncommitted changes in your working directory.

OPTIONS
-------
<commit>::
Commit to revert.
<commit>...::
Commits to revert.
For a more complete list of ways to spell commit names, see
"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
Sets of commits can also be given but no traversal is done by
default, see linkgit:git-rev-list[1] and its '--no-walk'
option.

-e::
--edit::
Expand Down Expand Up @@ -59,11 +64,11 @@ more details.

-n::
--no-commit::
Usually the command automatically creates a commit with
a commit log message stating which commit was
reverted. This flag applies the change necessary
to revert the named commit to your working tree
and the index, but does not make the commit. In addition,
Usually the command automatically creates some commits with
commit log messages stating which commits were
reverted. This flag applies the changes necessary
to revert the named commits to your working tree
and the index, but does not make the commits. In addition,
when this option is used, your index does not have to match
the HEAD commit. The revert is done against the
beginning state of your index.
Expand All @@ -75,6 +80,20 @@ effect to your index in a row.
--signoff::
Add Signed-off-by line at the end of the commit message.

EXAMPLES
--------
git revert HEAD~3::

Revert the changes specified by the fourth last commit in HEAD
and create a new commit with the reverted changes.

git revert -n master\~5..master~2::

Revert the changes done by commits from the fifth last commit
in master (included) to the third last commit in master
(included), but do not create any commit with the reverted
changes. The revert only modifies the working tree and the
index.

Author
------
Expand All @@ -84,6 +103,10 @@ Documentation
--------------
Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.

SEE ALSO
--------
linkgit:git-cherry-pick[1]

GIT
---
Part of the linkgit:git[1] suite
Loading

0 comments on commit 8c7da86

Please sign in to comment.