【问题标题】:Preventing git merge from confirming commit message防止 git merge 确认提交消息
【发布时间】:2012-12-16 10:12:04
【问题描述】:

我正在编写一个脚本,在该脚本中我逐渐将 Linux 内核合并到一个从旧版本起飞并稍作修改的分支中。

因此,我的脚本中有许多git merge <sha> -m "merge without conflict" 命令。如果存在冲突,脚本将停止以供用户解决并提交合并并带有适当的消息。

但是,git merge -m "message" ... 仍然会调出编辑器,迫使我确认消息。我怎样才能防止这种情况发生?

我知道一般来说,使用非描述性的合并消息不是一个好主意,但这是一个不会产生冲突的消息,并且可能会发生数百次,因此每次都要求用户(我自己)确认是不可能的。

编辑:情况并非总是如此。但是,这可以重现问题:

# Clone Linux's repository

$ git checkout v2.6.38
$ git checkout -b test

$ touch new_file
$ git add new_file
$ git commit

$ git merge v2.6.39 -m "merge message"
# brings up the editor, even though there are no conflicts

【问题讨论】:

    标签: git


    【解决方案1】:

    也许是--no-edit 标志? documentation 表示“--no-edit 选项可用于在合并带注释的标签时接受自动生成的消息(通常不鼓励这样做)......”

    【讨论】:

    • 不敢相信!我猜 Ubuntu 12.04 中的 git-doc 很旧,它只有 --edit 标志。谢谢,成功了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-27
    • 1970-01-01
    • 2011-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多