Recover from git reset --hard?

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

    If you use something like IntelliJ:

    On the context menu, choose Local History, and click Show History on the submenu:

    The local history view for a project or folder shows you everything that you have done during the last few days. In the Action column of the lower part of the dialog box, select the action you want to roll back. [...] So doing, the upper part of the dialog box shows the tree view of changed files. If you want to restore the deleted file only, regardless of the other changes that have been done since then, you can select the file Lost.txt in the tree view and click the Revert button.

    http://blog.jetbrains.com/idea/2008/01/using-local-history-to-restore-deleted-files/

    This just got my arse out the fire!

提交回复
热议问题