gpt4 book ai didi

git - 我如何 `git rebase -i` 并防止 "You asked to amend the most recent commit, but doing so would make it empty."?

转载 作者:IT王子 更新时间:2023-10-29 01:25:29 32 4
gpt4 key购买 nike

我想运行一个git rebase -i some-hash

当我运行它时,出现错误:

You asked to amend the most recent commit, but doing so would make it empty. You can repeat your command with --allow-empty, or you can remove the commit entirely with "git reset HEAD^".
[...]
Could not apply [...]

该错误似乎特定于单个提交,因为 --allow-empty 不是我可以传递给 rebase 的选项。

显然 --keep-empty 是我可以传递给 git rebase 的选项,但它似乎无法解决问题。

我如何 rebase ,并告诉 git,如果 rebase 中的提交最终没有效果,请不要担心?

最佳答案

好像在运行:

git commit --allow-empty
git rebase --continue

创建 2 个压缩的提交,而不是一个。运行 git rebase -i some-hash 允许我将 2 个新提交压缩为一个。

关于git - 我如何 `git rebase -i` 并防止 "You asked to amend the most recent commit, but doing so would make it empty."?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37599665/

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