Recover from git reset --hard?

后端 未结 22 2520
盖世英雄少女心
盖世英雄少女心 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:43

    Yes, YOU CAN RECOVER from a hard reset in git.

    Use:

    git reflog
    

    to get the identifier of your commit. Then use:

    git reset --hard 
    

    This trick saved my life a couple of times.

    You can find the documentation of reflog HERE.

提交回复
热议问题