简体   繁体   English

gitcherry-pick -x 默认

[英]git cherry-pick -x default

In the man page for git 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.

...

Is there a config setting to locally set the default back to -x , and allow -r to disable it?是否有配置设置可以在本地将默认值设置回-x ,并允许-r禁用它? I couldn't find one, but I may have missed it.我找不到,但我可能错过了。

Short of making an alias for git cherry-pick -x , no, this is not possible. 没有为git cherry-pick -x制作别名,不,这是不可能的。

(Fun fact: The default was changed in commit abd6970 .) (有趣的事实:在commit abd6970中更改了默认值。)

add this alias to your ~/.gitconfig by running:通过运行将此别名添加到您的 ~/.gitconfig 中:

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

You can then simply run:然后你可以简单地运行:

git pick abc123

You may replace the choice of "pick" to whatever word makes sense to you.您可以将“pick”选项替换为对您有意义的任何词。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM