The content added to the index can be retrieved (but only the file content, no file name information, requires manual identification), the parts that have not been added have been deleted, you can only resort to other methods (backup files, undelete recovery, etc.).
As far as I know, you can’t restore without stage changes.
If stage(add) is passed, it may be possible to recover (provided that git gc cannot be run):
Use git fsck --lost-found 找到 dangling blob,然后使用 git show <sha_id> to see if this file is one you have restored before.
The content added to the index can be retrieved (but only the file content, no file name information, requires manual identification), the parts that have not been added have been deleted, you can only resort to other methods (backup files, undelete recovery, etc.).
As far as I know, you can’t restore without stage changes.
If stage(add) is passed, it may be possible to recover (provided that git gc cannot be run): Use
git fsck --lost-found
找到dangling blob
,然后使用git show <sha_id>
to see if this file is one you have restored before.git reset --hard HEAD~1
You can recover