Last commit passed after hard reset

I made my changes and did not push them to the server. Then I did a hard reset one of my previous commits, and my last command disappeared. Does this mean that commits that were not transferred to the server are gone after a hard reset?

edit: Is it possible to restore my last commit?

+4
source share
1 answer

Yes, but not right away. Reflog entries expire on time and the contents will disappear when garbage collection.

You can return them from reflog:

git reflog 

and reset to them / checkout:

 git reset HEAD@ {1} 

or, for example, checking it for an emergency branch:

 git checkout -b rescue HEAD@ {1} 
+11
source

All Articles