Merge branch 'as/cherry-pick-no-commit-doc'

The documentation for 'git cherry-pick' has been updated to clarify
that the '--no-commit' option intentionally skips setting the
'CHERRY_PICK_HEAD' ref.  A test has also been added to ensure this
behavior holds even when the operation stops for conflicts.

* as/cherry-pick-no-commit-doc:
  doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD
  t3507: check no CHERRY_PICK_HEAD after conflicting --no-commit
main
Junio C Hamano 2026-09-13 21:53:30 -07:00
commit 994e80a373
2 changed files with 9 additions and 2 deletions

View File

@ -25,7 +25,8 @@ happens:
1. The current branch and `HEAD` pointer stay at the last commit
successfully made.
2. The `CHERRY_PICK_HEAD` ref is set to point at the commit that
introduced the change that is difficult to apply.
introduced the change that is difficult to apply, unless the
`--no-commit` option was given.
3. Paths in which the change applied cleanly are updated both
in the index file and in your working tree.
4. For conflicting paths, the index file records up to three
@ -101,6 +102,11 @@ OPTIONS
+
This is useful when cherry-picking more than one commits'
effect to your index in a row.
+
This option does not record `CHERRY_PICK_HEAD`, so a plain `git commit`
afterwards records you as the author. That is by design: what you are
building is your own work, which you keep changing before committing,
rather than a reproduction of the original commit.

-s::
--signoff::

View File

@ -79,7 +79,8 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
EOF
test_must_fail git cherry-pick --no-commit picked 2>actual &&

test_cmp expected actual
test_cmp expected actual &&
test_ref_missing CHERRY_PICK_HEAD
"

test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' '