When you accidentally deleted a commit and want to recover it later, the following method will work.
Suppose you are working on a very important project and intentionally or unintentionally deleted the commit using git reset --hard HEAD^, and later realized that some uncommitted code was also deleted. Oh no😲🥲🥹
Use the following commands to get back to the particular commit:
git refloggit reset --hard <commit-hash>
Note: <commit-hash> is the value you will get from the `git reflog` command. Execute both commands to get back to your deleted commit.
Happy coding!😇