git cherry-pick -x默认

ver*_*nzt 12 git config cherry-pick

在手册页中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.

...
Run Code Online (Sandbox Code Playgroud)

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

ver*_*nzt 7

除了别名之外git cherry-pick -x,不,这是不可能的.

(有趣的事实:在commit abd6970中更改了默认值.)


小智 5

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

git config --global --replace-all alias.pick "cherry-pick -x"
Run Code Online (Sandbox Code Playgroud)

然后你可以简单地运行:

git pick abc123
Run Code Online (Sandbox Code Playgroud)

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