【问题标题】:Squash on default when using git subtree使用 git subtree 时默认为 Squash
【发布时间】:2016-03-29 14:18:42
【问题描述】:

我经常跑步

git subtree pull -P shared shared master

但我通常忘记将--squash 放在最后,这最终会复制我的大部分 git 历史记录。是否可以让 git 默认使用它?

谢谢!

【问题讨论】:

    标签: git git-subtree


    【解决方案1】:

    你可以使用:

    git config branch.master.mergeoptions "--squash"

    或者,如果您希望此行为对您的所有 git 项目具有全局性:

    git config --global branch.master.mergeoptions "--squash"

    编辑:

    正如 Ingo 所指出的,此解决方案通常会将 --squash 选项应用于 merge 操作。

    【讨论】:

    • 这不适用于所有合并吗?不仅在使用子树时?
    • 是的。我用你的评论编辑了我的答案。我不认为git config 中的子树有任何特定的内容,所以如果你想要这样,我认为你会被困在学习每次添加选项或使用别名的过程中。 :-)
    猜你喜欢
    • 2013-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 2012-08-13
    • 1970-01-01
    • 2015-04-20
    • 2016-07-26
    相关资源
    最近更新 更多