From backhub.co
Managing branches or commits in Git can be quite cumbersome. Issues ranging from merge conflicts to accidentally deleting branches are a nightmare for many developers. It could get even worse if you are working with a bunch of other developers, as it’s easy to modify or even completely remove another person’s work, whether knowingly or inadvertently.
In this tutorial, you will learn how to recover your deleted commits or branches using the `git reflog`
command. This command is used to get a record of references to the tips of branches and commits that have been updated. Per the official `git`
documentation,
“Reference logs, or “reflogs,” record when the tips of branches and other references were updated in the local repository. Reflogs are useful in various Git commands, to specify the old value of a reference.”