Git merge不使用默认合并消息,使用默认消息打开编辑器

kjb*_*kjb 68 git git-merge

如何强制git merge使用默认合并消息而不是使用所述消息加载我的编辑器?

我没有列出编辑器git config -l,所以我不确定为什么它会打开一个编辑器.

kjb*_*kjb 85

经过一番挖掘后找到了答案

编辑:根据马克的建议,这是最好的方法:

git config --global core.mergeoptions --no-edit
Run Code Online (Sandbox Code Playgroud)

  • 不要直接编辑`〜/ .gitconfig`,建议使用`git config`来做这件事可能更安全,例如`git config --global core.mergeoptions --no-edit`,这样就没有机会创建了格式错误的`〜/ .gitconfig`. (15认同)
  • 通过git源和发行说明的旅行表明现在没有,并且从来没有'core.mergeoptions`.但是,当`git merge`本身被更改为调出编辑器时,有一个`GIT_MERGE_AUTOEDIT = no`被添加到git 1.7.10中.@cmbuckley指出,还有一些选项可用作`branch.*.inmeroptions`. (5认同)
  • 这对我不起作用。merge 和 pull 仍然会在非 ff 合并上打开一个编辑器。使用 git 1.7.10.4 (4认同)
  • 这似乎适用于`git merge`,但我仍然有一个编辑器为`git pull`打开.有没有办法为此禁用提交消息? (3认同)
  • 我找不到提到`core.mergeoptions`,虽然它肯定适用于`branch.*.incinoptions`.有谁知道这个支持的版本? (2认同)
  • 在1.9.1中也不起作用(Ubuntu 14.04) (2认同)

oua*_*uah 62

使用

export GIT_MERGE_AUTOEDIT=no
Run Code Online (Sandbox Code Playgroud)

要么

git merge --no-edit
Run Code Online (Sandbox Code Playgroud)

  • 对我来说,当导入的答案(`git config --global core.mergeoptions --no-edit`)没有时,`export GIT_MERGE_AUTOEDIT = no`工作(用于合并). (5认同)

Orl*_*ndo 9

这是Git 1.7.10中引入的Git的一个新功能,使用旧的(在合并时不提供消息)将这两行放在你的.bash_profile.bashrc

GIT_MERGE_AUTOEDIT=no
export GIT_MERGE_AUTOEDIT
Run Code Online (Sandbox Code Playgroud)