gpt4 book ai didi

Git rebase --continue 不打开编辑器

转载 作者:行者123 更新时间:2023-12-04 03:52:15 26 4
gpt4 key购买 nike

在正常的 rebase 冲突后调用 git rebase --continue 时,编辑器 ( GIT_EDITOR ) 将打开并要求修改提交消息。因为提交消息可能包含前导 # 这可能会失败。

$ export GIT_EDITOR=true
$ git rebase --continue
Aborting commit due to empty commit message.
error: could not commit staged changes.
Git rebase documentation 中有以下段落

Commit RewordingWhen a conflict occurs while rebasing, rebase stops and asks the user to resolve. Since the user may need to make notable changes while resolving conflicts, after conflicts are resolved and the user has run git rebase --continue, the rebase should open an editor and ask the user to update the commit message. The merge backend does this, while the apply backend blindly applies the original commit message.


所以我尝试切换到应用后端,但它仍然失败:
$ export GIT_EDITOR=true
$ git config rebase.backend apply
$ $ git config --list | grep backend
rebase.backend=apply
$ git rebase --continue
Aborting commit due to empty commit message.
error: could not commit staged changes.
如何强制 Git 盲目应用提交消息?

最佳答案

我发现的一种解决方法是指定从 core.commentChar 检测到的 .git/rebase-merge/message (此处为 @ ):

git -c core.commentChar=@ rebase --continue

关于Git rebase --continue 不打开编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64276769/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com