简体   繁体   English

git -add然后git -rm -r在提交之前删除了整个项目

[英]git -add then git -rm -r deleted entire project before commit

I'm on Windows 10, new to git. 我在Windows 10上,是git的新手。 Lost my project before committing. 提交之前丢失了我的项目。 I used git commands in this order (project name is DeltaSearch located in c:/git/dev/utils/DeltaSearch with c:/git/dev being the repository root). 我按此顺序使用了git命令(项目名称为DeltaSearch,位于c:/ git / dev / utils / DeltaSearch中,其中c:/ git / dev为存储库根目录)。

git add DeltaSearch/* 

added too many files , then tried to start over 添加了太多文件,然后尝试重新开始

git rm Deltasearch/* -r -f

Entire project was deleted from the SSD. 整个项目已从SSD中删除。 I've tried: 我试过了:

git reset -HEAD

It's still gone. 它仍然不见了。 Also tried: 还尝试了:

git stash

git stash drop

Still gone. 仍然不见了。 Afraid to try any other commands unless someone knows if this is fixable. 除非有人知道这是可修复的,否则不要尝试其他命令。 Thank you. 谢谢。

Your content's still in the repo, that's what git add does, add content to the repo, but since you never committed wiping the index erased the only association with the right pathnames. 您的内容仍在仓库中,这就是git add所做的,将内容添加到仓库中,但是由于您从未承诺擦除索引,因此擦除了唯一与正确路径名的关联。 Best you can do is 最好的办法是

git fsck --lost-found

see its docs for what it does, basically look in .git/lost-found/other for the content you added and hopefully it won't be to hard to assign the right pathnames for each. 请参阅其文档以了解其功能,基本上在.git/lost-found/other查找您添加的内容,希望它不会为每个分配正确的路径名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM