使用 GitHub Windows 客户端我做了一个sync将远程更改拉取到本地计算机,但在完成同步之前,我用完了磁盘空间,同步失败。现在我似乎有一堆本地更改,这些更改实际上是从原点拉取的更改。我尝试运行 git pull 但得到:
C:\Users\Tom\SourceLog [master +4 ~26 -0 !]> git pull
Updating b3a86e1..5afd74f
error: Your local changes to the following files would be overwritten by merge:
SourceLog.Interface/IChangedFile.cs
SourceLog.Interface/ILogEntry.cs
...
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
Lib/MSBuildExtensionPack/4.0.6.0/Ionic.Zip.dll
Lib/MSBuildExtensionPack/4.0.6.0/MSBuild.ExtensionPack.dll
...
Aborting
所以现在我试图放弃本地更改,但我得到:
C:\Users\Tom\SourceLog [master +4 ~26 -0 !]> git checkout -- .
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) y
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) n
fatal: unable to write new index file
我该如何清理这个? (在开始同步之前我没有进行任何本地更改。)
Update
好像无法重置头..
C:\Users\Tom\SourceLog [master +4 ~0 -0 !]> git reset head
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) y
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) n
error: Could not write new index file.
fatal: Could not reset index file to revision 'head'.
就我而言,这是由于在管理和非管理命令提示符下使用相同的 Git 存储库造成的。最后一次是什么时候git pull
来自管理员cmd,index
是由它创建的,然后非管理员cmd没有足够的权限来修改它。
我的解决方案是重新创建index
(同时保持工作树完整):
del .git\index
del .git\index.lock
git reset --mixed head
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)