Recovering added/staged file after doing git reset --hard HEAD^?

后端 未结 5 1819
难免孤独
难免孤独 2020-11-22 10:03

I added a new file F1 and made changes to another file F2 but then did a "git reset --hard HEAD^" and I have lost all the changes to the files.

Is there

5条回答
  •  粉色の甜心
    2020-11-22 10:36

    You can (with some work) recover state of file at the last "git add ". You can use

    $ git fsck --cache --no-reflogs --lost-found --dangling HEAD
    

    and then examine files in '.git/lost-found/other' directory.

    Please read git fsck manpage.

提交回复
热议问题