gpt4 book ai didi

git - 如何在 "Unable to create ' .git/index.lock' : File exists. 之后恢复 rebase “?

转载 作者:太空狗 更新时间:2023-10-29 14:05:03 25 4
gpt4 key购买 nike

我运行 Xcode,它会自动运行 git 操作。这可能会导致某些 rebase -i 操作失败,如果 Xcode 启动操作的速度比 git 快。结果是:

fatal: Unable to create '.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

Xcode 任务在我可以做任何事情之前完成,所以 index.lock 已经消失,我应该准备好继续。

好的,所以我尝试 git rebase --continue,因为另一个操作现在已经完成,index.lock 应该消失了。然而,这很快就爆炸了,并出现如下错误消息:

The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

git commit --allow-empty

Otherwise, please use 'git reset'
interactive rebase in progress; onto abcdef
Last commands done (X commands done):
pick abcdef Something
pick abcdef Something
Next commands to do (Y remaining commands):
pick abcdef Something
pick abcdef Something
You are currently rebasing branch 'foo' on 'abcdef'.

nothing to commit, working directory clean
Could not apply abcdef

至此,我干脆放弃,--abort,重新开始。我失去了我制定的 rebase 策略,以及我解决的任何冲突。我该怎么做才能正确恢复此过程而不丢失任何数据?

就此问题而言,“在 rebase 前关闭 Xcode”不是我要找的答案。假设我已经忘记这样做,并且处于这种损坏状态(另外,Xcode 需要很长时间才能启动,而且这种情况很少发生)。

最佳答案

继续 git rebase --continue 不起作用,因为 git 在实际应用有问题的补丁之前失败了。但您可以手动执行此操作:

git apply .git/rebase-apply/patch

然后,如有必要,解决冲突并使用 git add 将更改的文件添加到索引,最后使用 git rebase --continue

关于git - 如何在 "Unable to create ' .git/index.lock' : File exists. 之后恢复 rebase “?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37080474/

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