Need Assistance?

support@tutorialshub.in

Undoing Changes and Rewriting History

Reflog and recovering lost commits

ADVERTISEMENT
Git Free Lesson
5 min read
ADVERTISEMENT

Reflog records local reference movements

The reflog records changes to references such as HEAD in your local repository. It can help locate commits after a reset, rebase or branch deletion when the commit is no longer reachable from a normal branch.

Recovery workflow

First inspect the reflog and identify the commit hash that contains the missing work. Create a new branch at that commit before performing further cleanup. This gives the recovered commit a stable reference.

Important limitation

Reflog is local and is not a substitute for backups or remote repositories. Unreachable objects can eventually be pruned, so recovery should be attempted promptly.

ADVERTISEMENT