To return to this post, you can use reflog to find it.
Help logs or "logs", a record of when branch ends and other links have been updated in the local repository.
Run this command:
git reflog
Scan the first few records and find the commit that was lost. Keep track of the identifier with this commit (you can use either the 1st or 2nd columns). Let’s call the identifier "ID".
If you haven't done any extra work since you did a reset -hard, you can do:
git reset --hard ID git push -f origin master
If you did another job since reset, you could choose cherry-pick if you go back to your branch, like this:
git cherry-pick ID git push origin master
Jonathan.Brink
source share