代码之家  ›  专栏  ›  技术社区  ›  Timmmm

Git rebase最终提交不存在

  •  3
  • Timmmm  · 技术社区  · 7 年前

    我正处于一个长期的调整期,一切都很顺利,直到我的 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 回复  |  直到 7 年前
        1
  •  3
  •   Melebius    7 年前

    我不知道如何修复您现有的回扣,但我会通过做另一个来解决:

    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
    

    然后,您可以通过以下操作继续失败的重新基准:

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

    它将打开编辑器。您应该使用原始的 git-rebase-todo 文件保存文件,退出编辑器,然后重新设置基础。完成后,移除临时分支。

    推荐文章