致命:无法打开文件.git/rebase-merge/done用于读取:没有这样的文件或目录



我本来打算重新创建一个数据库来删除我的最后一次提交,但我不想完成,所以我退出了。(我意识到这可能不是最好的方法,但它已经完成了(我想我做错了,因为我每次运行git status都会得到错误:fatal: Could not open file .git/rebase-merge/done for reading: No such file or directory。我如何摆脱这个错误,以便继续进行提交?我可以删除这个文件吗?如果我可以删除它,我该怎么做?

在尝试以下操作之前,请确保先stashcommit任何未提交的更改,否则将无法挽回地丢失这些更改。

然后试着做一个git rebase --abort

Stash或commit对我不起作用,我只是创建了git抱怨的文件,直到它起作用!

$ git rebase --abort
error: could not read '.git/rebase-apply/head-name': No such file or directory
echo "master" > .git/rebase-apply/head-name
$ git rebase --abort
error: could not read '.git/rebase-apply/onto': No such file or directory
$ echo "develop" > .git/rebase-apply/onto
$ git rebase --abort
error: could not read '.git/rebase-apply/head': No such file or directory
$ echo "develop" > .git/rebase-apply/head

之后CCD_ 6起作用。你放在这些文件中的分支名称需要存在,在我的情况下,我不关心我的本地更改,但如果你这样做的话,显然要小心。

DavidN中止重组的解决方案是,只要自上次重组以来没有任何未记录的更改!

如果您在重新基准尝试之后编写代码,则忽略could not open file .git/rebase-merge/done消息,

那么你最好的选择就是做

git stash

以保存您的本地更改,然后才中止重新基准。

我相信这是一个stackoverflow问题,那些急于在不考虑影响的情况下解决问题的人,只会运行中止命令,并在不久后后悔。

我刚刚完成了:

git add .
git commit -m "change inter rebase"

然后可以继续:

git rebase --continue

git stash 
git rebase --abort 

需要。

对于在Visual Studio代码中执行此操作的人,请关闭正在运行的终端/shell,然后运行git rebase --quit

这样做可以解决问题。

最新更新