Jacob Lyles Jacob Lyles - 1 year ago 74
Git Question

Recover from git reset --hard?

Is there any way to recover uncommitted changes to the working directory from a

git reset --hard HEAD

Answer Source

You cannot get back uncommitted changes in general, so the real answer here would be: look at your backup. Perhaps your editor/IDE stores temp copies under /tmp or C:\TEMP and things like that.[1]

git reset HEAD@{1}

This will restore to the previous HEAD

[1] vim e.g. optionally stores persistent undo, eclipse IDE stores local history; such features might save your a**

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download