Git rebase final-commit不存在

时间:2018-04-23 09:33:21

标签: git rebase

我正处于一个长期的变革中,一切顺利,直到我的git rebase --continue之一,我得到了这个:

$ git rebase --continue
Applying: A git commit
fatal: Unable to create '/Users/me/mycode/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

我没有删除该文件,因为它已不存在。我想也许一个git GUI程序试图刷新,而我在变基础或其他东西。好的。我再次尝试,但现在我得到了

$ git rebase --continue
fatal: cannot resume: .git/rebase-apply/final-commit does not exist.

它确实不存在:

$ ls .git/rebase-apply/
0001  0005  0009  0013  0017  0021  abort-safety  last       orig-head          rebasing   threeway
0002  0006  0010  0014  0018  0022  apply-opt     messageid  patch              rewritten  utf8
0003  0007  0011  0015  0019  0023  head-name     next       patch-merge-index  scissors   
0004  0008  0012  0016  0020  0024  keep          onto       quiet              sign    

有没有办法解决这个烂摊子?这是一个很长的变形因此我不想git rebase --abort

1 个答案:

答案 0 :(得分:3)

我不知道如何修复现有的rebase,但我会通过另外一个来解决这个问题:

cp .git/rebase-merge/git-rebase-todo ~/another-folder # backup what is to be done
git branch failed-rebase                              # save the current point as a branch
git rebase --abort

然后您可以使用以下命令继续失败的rebase:

git rebase -i --onto failed-rebase <original rebase parameters here>

打开编辑器。您应该使用原始git-rebase-todo文件使待办事项列表与最初的匹配。保存文件,退出编辑器,rebase将启动。完成后,删除临时分支。

相关问题