Skip to main content

Reset - Last

However, just in case it happens, don’t worry, there’s a remedy. Type the following command:

$ git reflog

In fact git maintains uncommitted changes on a parallel Directed Acyclic Graph (DAG) for internal bookkeeping. The previous command should show the Head states previous to running git reset –hard. Just pick the most recent Head that matches your changes that you want to recover. Afterwards, reset the current Head to that previous Head using:

$ git reset –hard Head@{4}