【问题标题】:Merge branch in GIT and keep the commit message在 GIT 中合并分支并保留提交消息
【发布时间】:2019-07-14 02:45:04
【问题描述】:

我想在 GIT 中合并一个分支并保留 COMMIT MESSAGE。

不想要git merge --no-edit 这会保留默认消息:Merge branch 'master' into develop

需要:我想复制消息:ACC-9187 Reformat code,而不是 Merge 分支 ...。 。 ==> 合并必须包含相同的消息。 当然,我不想再次输入整个消息...:不是: git merge -m "ACC-9187 Reformat code"

==> 有什么建议吗?谢谢!

【问题讨论】:

    标签: git merge branch message commit


    【解决方案1】:

    合并完成后,在你进行任何新的提交之前,运行:

    git commit --amend -C HEAD^2
    

    如果您想要单行解决方案:

    git merge master -m "$(git log -1 --pretty=%B master)"
    

    【讨论】:

      猜你喜欢
      • 2015-10-19
      • 2015-04-17
      • 2013-02-07
      • 2021-06-26
      • 2011-11-06
      • 2011-03-28
      • 1970-01-01
      • 2012-03-02
      • 2013-06-10
      相关资源
      最近更新 更多