Meg*_*mon 7 git github git-reset
我尝试软重置我的分支以删除我不小心推送到 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.
Run Code Online (Sandbox Code Playgroud)
我发现另一篇 StackOverflow 文章说要使用以下命令删除 .git/index.lock:
rm -f ./.git/index.lock
Run Code Online (Sandbox Code Playgroud)
当我运行该命令并尝试从另一个分支签出或拉取时,我现在得到这个 BUG:
BUG: unpack-trees.c:699: pos must point at the first entry in this directory
Run Code Online (Sandbox Code Playgroud)
我不知道如何清理我的存储库并确保所有 git 进程都已完成/中止。有什么建议如何解决这个问题吗?
小智 8
我遇到了同样的错误。当我尝试时git reset --hard HEAD,我收到了有关 index.lock 文件的消息。因此,我手动删除了该文件,再次尝试硬重置,然后得到了BUG: unpack-trees.c etc etc....
最终对我有用的是 - 因为我不关心丢失已做出的任何更改 - 检查以git status查看所有更改,然后使用git restore --staged .简单地删除 git 正在监视的所有内容。
之后,我就可以毫无问题地查看我想要切换到的分支。
小智 3
我意外地设法将所有源文件暂存到我的源代码树中以供删除,然后遇到了相同的错误。
我无法进行重置或结账,但最终能够通过以下方式恢复一切
git restore .
之后就可以正常使用git了。
也许这有帮助...
| 归档时间: |
|
| 查看次数: |
2454 次 |
| 最近记录: |