Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以运行
git fsck
当我确定我删除的文件位于我的 Mac 中的特定文件夹下时,对于特定文件夹?
Git不会删除对象,它只是删除了对它的引用。
该git-fsck命令验证数据库中对象的连通性和有效性。
git-fsck
您可以git-fsck在存储库上执行命令。使用该--unreachable参数,它将向您显示无法访问的对象,即无法访问的提交、无法访问的 blob 等。之后,您还可以使用git-show命令查看每个对象。一旦你找到了与你删除的文件相对应的那个,你就可以运行git-stash apply *commit ID*再次将提交应用到你的主分支。
--unreachable
git-show
git-stash apply *commit ID*