Recover from git reset --hard?

后端 未结 22 2558
盖世英雄少女心
盖世英雄少女心 2020-11-22 00:52

Is there any way to recover uncommitted changes to the working directory from a git reset --hard HEAD?

22条回答
  •  梦谈多话
    2020-11-22 01:50

    I found out the hard way that any uncommitted files before a git reset --hard gets removed from git history. However, I was lucky enough to have kept my code editor session open during the entire time I was pulling my hair out, that I discovered that a simple control + z in each of the affected files returned the state of the file back to the version before Git so obligingly reset everything I didn't ask it to specifically. Hooray!!

提交回复
热议问题