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 add应该可以通过以下方式恢复:
git add
git fsck --lost-found
这将创建您添加到索引但从未在.git/lost-found/other目录中提交的文件。文件名将改为 SHA,因此您必须一一查看以知道哪个是哪个。
.git/lost-found/other