Files
git/Documentation
Brian Lyles ec79d763de cherry-pick: add --empty for more robust redundant commit handling
As with git-rebase(1) and git-am(1), git-cherry-pick(1) can result in a
commit being made redundant if the content from the picked commit is
already present in the target history. However, git-cherry-pick(1) does
not have the same options available that git-rebase(1) and git-am(1) have.

There are three things that can be done with these redundant commits:
drop them, keep them, or have the cherry-pick stop and wait for the user
to take an action. git-rebase(1) has the `--empty` option added in commit
e98c4269c8 (rebase (interactive-backend): fix handling of commits that
become empty, 2020-02-15), which handles all three of these scenarios.
Similarly, git-am(1) got its own `--empty` in 7c096b8d61 (am: support
--empty=<option> to handle empty patches, 2021-12-09).

git-cherry-pick(1), on the other hand, only supports two of the three
possiblities: Keep the redundant commits via `--keep-redundant-commits`,
or have the cherry-pick fail by not specifying that option. There is no
way to automatically drop redundant commits.

In order to bring git-cherry-pick(1) more in-line with git-rebase(1) and
git-am(1), this commit adds an `--empty` option to git-cherry-pick(1). It
has the same three options (keep, drop, and stop), and largely behaves
the same. The notable difference is that for git-cherry-pick(1), the
default will be `stop`, which maintains the current behavior when the
option is not specified.

Like the existing `--keep-redundant-commits`, `--empty=keep` will imply
`--allow-empty`.

The `--keep-redundant-commits` option will be documented as a deprecated
synonym of `--empty=keep`, and will be supported for backwards
compatibility for the time being.

Signed-off-by: Brian Lyles <brianmlyles@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-03-25 16:45:41 -07:00
..
2024-03-07 15:59:42 -08:00
2023-10-30 07:09:55 +09:00
2023-11-26 10:07:05 +09:00
2023-06-12 13:52:51 -07:00
2023-10-09 12:06:24 -07:00
2023-10-09 12:06:29 -07:00
2023-11-26 10:07:05 +09:00
2023-12-26 11:06:55 -08:00
2024-02-21 10:02:55 -08:00
2023-10-09 12:06:29 -07:00
2023-06-12 13:52:51 -07:00
2023-06-12 13:52:51 -07:00
2024-01-02 13:51:30 -08:00
2023-10-09 12:06:24 -07:00
2024-03-07 15:59:40 -08:00
2023-10-09 12:06:29 -07:00
2023-12-14 14:38:07 -08:00
2023-12-26 11:06:55 -08:00
2019-05-07 13:04:48 +09:00
2023-08-28 09:16:06 -07:00
2023-11-26 10:07:05 +09:00
2023-12-26 11:06:55 -08:00