【发布时间】:2012-09-26 23:11:17
【问题描述】:
如何强制git merge 使用默认的合并消息,而不是用所述消息加载我的编辑器?
git config -l 中没有列出编辑器,所以我不确定它为什么会打开编辑器。
【问题讨论】:
-
不确定,但不合并 - 作为提交 - 有选项
--no-edit?
如何强制git merge 使用默认的合并消息,而不是用所述消息加载我的编辑器?
git config -l 中没有列出编辑器,所以我不确定它为什么会打开编辑器。
【问题讨论】:
--no-edit?
经过一番挖掘,找到了答案
编辑:根据马克的建议,这是最好的方法:
git config --global core.mergeoptions --no-edit
【讨论】:
~/.gitconfig,不如建议使用git config 来执行此操作更安全,例如git config --global core.mergeoptions --no-edit,这样就没有机会创建格式错误的~/.gitconfig。
git merge,但我仍然为git pull 开放了一个编辑器。有什么办法也可以禁用提交消息吗?
core.mergeoptions,尽管它肯定适用于branch.*.mergeoptions。有谁知道这个支持的版本?
core.mergeoptions。但是,当 git merge 本身被更改以调出编辑器时,将 GIT_MERGE_AUTOEDIT=no 添加到 git 1.7.10 中。正如@cmbuckley 所指出的,还有branch.*.mergeoptions 可用的选项。
使用
export GIT_MERGE_AUTOEDIT=no
或
git merge --no-edit
【讨论】:
git merge 的默认行为
git merge。也许git merge -m "message" 有效,但我还没有尝试过。
export GIT_MERGE_AUTOEDIT=no 在接受的答案 (git config --global core.mergeoptions --no-edit) 不起作用时起作用(用于合并)。
这是 Git 的一项新功能,introduced in Git 1.7.10,使用旧功能(不要在合并时提供消息)将这两行放入您的 .bash_profile 或 .bashrc
GIT_MERGE_AUTOEDIT=no
export GIT_MERGE_AUTOEDIT
【讨论】:
试试这个
git merge --no-ff --no-edit -m "my custom merge message" somebranch
【讨论】: