BUG:unpack-trees.c:699:pos必须指向该目录中的第一个条目

问题描述

我试图对分支进行软重置,以删除我不小心推送到GitHub的目录。软重置后,我仍然收到以下错误

fatal: Unable to create '/Users/mprestemon/vagrant-local/www/national-fuel/public_html/wp-content/.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.

我碰到另一篇StackOverflow文章内容是说要使用以下命令删除.git / index.lock:

rm -f ./.git/index.lock

当我运行该命令并尝试从另一个分支中签出或提取时,我现在得到了这个错误

BUG: unpack-trees.c:699: pos must point at the first entry in this directory

我不知道如何清理我的存储库,并确保所有git进程都已完成/中止。任何建议如何解决这个问题?

解决方法

我不小心设法在源代码树中暂存了所有要删除的源文件,之后又遇到了相同的错误。

我无法进行重置或签出,但最终能够通过以下方式恢复一切

git restore .

然后可以再次正常使用git。

也许这有帮助...

,

我最终删除了所有本地内容,然后再次克隆了仓库。这似乎可以解决问题!