Git · Middle · Question 8 of 75
You ran git reset --hard and lost a commit. How can you get it back?
- ✓Correct answer: Find it in
git reflogand reset or branch to it - 2It's gone; reset deletes commits permanently
- 3Run
git revert --hardto undo the reset
Explanation
The reflog records every position HEAD and branches had locally, usually for 90 days. git branch rescue <hash> brings the commit back.