不慎在错误的目录执行了git checkout -- .
,导致最近的更改都被恢复成commit时的状态。
是否有命令可以找回丢失的更改呢?
PHP中文网2017-04-24 09:12:50
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.).
迷茫2017-04-24 09:12:50
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.