git merge --continue 不打开编辑器

eft*_*ft0 2 git merge editor

我正在编写一个经过许多 git 操作的脚本。有一个git merge失败。在合并操作中,我提供了带有-m. 如果在处理冲突后运行git merge --continue,我会看到一个编辑器,并且我能够看到我在第一次合并操作中使用的行,以便我可以编辑它们。现在,我想做的是运行,git merge --continue但我也希望 git 允许我最初用于修订的消息。如果我尝试使用git merge --continue --no-edit它惨遭失败:

$ git merge --continue --no-edit
fatal: --continue expects no arguments

usage: git merge [<options>] [<commit>...]
   or: git merge --abort
   or: git merge --continue
.
.
.
Run Code Online (Sandbox Code Playgroud)

然后我再次尝试设置消息:

$ git merge --continue -m "BLAH"
fatal: --continue expects no arguments

usage: git merge [<options>] [<commit>...]
   or: git merge --abort
   or: git merge --continue
.
.
.
Run Code Online (Sandbox Code Playgroud)

那么,我如何才能git merge --continue完全跳过文本编辑器并接受原始评论?

eft*_*ft0 5

经过几次尝试,我能够通过设置core.editor来做到这一点/bin/true

git -c core.editor=/bin/true merge --continue
Run Code Online (Sandbox Code Playgroud)

也应该像这样工作:

GIT_EDITOR=/bin/true git merge --continue
Run Code Online (Sandbox Code Playgroud)

  • 也适用于变基。可以缩短:`git -c core.editor=true rebase --continue` (3认同)