经过一番挖掘找到了答案
编辑:根据马克的建议,这是最好的方法:
git config --global core.mergeoptions --no-edit
利用
export GIT_MERGE_AUTOEDIT=no
或者
git merge --no-edit
git merge
的默认行为
git merge
,那就太好了。也许 git merge -m "message"
有效,但我还没有尝试过。
git config --global core.mergeoptions --no-edit
) 没有时,export GIT_MERGE_AUTOEDIT=no
有效(用于合并)。
这是 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
不定期副业成功案例分享
~/.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
。