在记录提交时,在原始提交信息中添加一行 "(cherry picked from commit …)",以表明这个改动是从哪个提交中拣选的。 这只适用于没有冲突的拣选。 如果你是从自己的私有分支中偷梁换柱,请不要使用这个选项,因为这个信息对接收者来说是无用的。 另一方面,如果您是在两个公开可见的分支之间进行拣选(例如,从开发分支向维护分支回传一个旧版本的修正),添加这一信息会很有用。
By default, cherry-picking an empty commit will fail, indicating that an explicit invocation of
git commit --allow-empty
is required. This option overrides that behavior, allowing empty commits to be preserved automatically in a cherry-pick. Note that when "--ff" is in effect, empty commits that meet the "fast-forward" requirement will be kept even without this option. Note also, that use of this option only keeps commits that were initially empty (i.e. the commit recorded the same tree as its parent). Commits which are made empty due to a previous commit will cause the cherry-pick to fail. To force the inclusion of those commits, use
--empty=keep
.