22

手册页中 git cherry-pick

...

-x
    When recording the commit, append a line that says "(cherry picked
    from commit …)" to the original commit message in order to indicate
    which commit this change was cherry-picked from. ...

-r
    It used to be that the command defaulted to do -x described above,
    and -r was to disable it. Now the default is not to do -x so this
    option is a no-op.

...

是否有配置设置可以在本地将默认设置回-x,并允许-r禁用它?我找不到,但我可能错过了。

4

2 回答 2

16

没有为 制作别名git cherry-pick -x,不,这是不可能的。

(有趣的事实:在提交abd6970中更改了默认值。)

于 2012-06-25T20:10:12.417 回答
2

通过运行将此别名添加到您的 ~/.gitconfig 中:

git config --global --replace-all alias.pick "cherry-pick -x"

然后,您可以简单地运行:

git pick abc123

您可以将“pick”的选择替换为对您有意义的任何词。

于 2021-12-09T17:33:32.420 回答