Another way that doesn't require doing a hard reset is to create a new branch with your desired starting point.
As with the other solutions, you use the reflog to find the correct starting point.
git reflog
(you can also use git log -g
here for more detail)
Then you note the reference to the commit SHA (ex: e86a52b851e
).
Finally, you use the git branch command.
git branch recover-branch e86a52b851e
Reference: https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery#_data_recovery