Git reflog
Thegit reflog command shows a log of all actions taken on your repository — including checkouts, resets, merges, and rebases — not just commits. This makes it an invaluable recovery tool.
Everyone makes mistakes. If you accidentally reset to the wrong commit or lose work, git reflog lets you see the exact commit hash before the mistake and restore to it.
Reflog is local — it tracks actions on your machine only and is not shared with the remote repository.