Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# View the reflog (most recent entries first): git reflog # Sample output: # abc1234 HEAD@{0}: reset: moving to HEAD~2 # def5678 HEAD@{1}: commit: Add payment form # ghi9012 HEAD@{2}: commit: Add checkout page # jkl3456 HEAD@{3}: checkout: moving from feature to main # Recover a commit that was reset away: git reset --hard HEAD@{1} # or: git reset --hard def5678 # Create a branch at a reflog entry to safely examine it: git branch recover-lost-work HEAD@{2} # View reflog for a specific branch: git reflog show feature/login # The reflog is LOCAL only — it is not pushed to remotes. # Entries older than 90 days are pruned automatically. # Protect yourself: before any dangerous operation: git tag backup-before-reset # create a tag as a bookmark # or note the current commit hash: git rev-parse HEAD
Result
Open