Search⌘ K
AI Features

Undo a Hard Reset with the git reflog Command

Explore how to use the git reflog command to undo a hard reset by locating deleted commits and restoring them. Learn the process of creating rescue branches, merging recovered commits, and cleaning your repo to maintain version control integrity.

The git reflog command

We can undo a hard reset with the git reflog command.

After we do a hard reset, we can’t see the changes of that commit in the git log or working directory anymore. But still, we can use reflog to rescue recently deleted commits.

We’ve run these commands in the terminal below to ...