Challenge - 5 Problems
Hard Reset Recovery Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of
git reflog after a hard reset?You ran
git reset --hard HEAD~2 and want to see the previous commit references to recover lost work. What does git reflog show?Git
git reflogAttempts:
2 left
💡 Hint
Think about how Git tracks HEAD movements even after resets.
✗ Incorrect
git reflog records all movements of HEAD, including resets. This lets you find commits lost after a hard reset.
🔀 Workflow
intermediate2:00remaining
Which command sequence recovers a commit lost after a hard reset?
You accidentally ran
git reset --hard HEAD~1 and want to restore the lost commit. Which sequence correctly recovers it?Attempts:
2 left
💡 Hint
Use the command that shows recent HEAD changes and then checkout the lost commit.
✗ Incorrect
git reflog shows lost commits. Checking out the commit hash from reflog recovers it.
❓ Troubleshoot
advanced2:00remaining
Why does
git reset --hard sometimes seem to lose commits permanently?After running
git reset --hard, you cannot find your previous commits in git log. What is the reason?Attempts:
2 left
💡 Hint
Think about how Git stores commit references separately from branch pointers.
✗ Incorrect
Hard reset moves the branch pointer but reflog keeps track of previous HEAD positions, so commits are not deleted immediately.
🧠 Conceptual
advanced2:00remaining
What is the role of
git reflog in recovering from a hard reset?Explain why
git reflog is essential for recovering commits after a hard reset.Attempts:
2 left
💡 Hint
Consider what information reflog stores about HEAD.
✗ Incorrect
git reflog tracks every change to HEAD, so even if commits are no longer on a branch, you can find their hashes here.
✅ Best Practice
expert2:00remaining
What is the safest way to avoid losing work when using
git reset --hard?Before running
git reset --hard, which practice best protects your work from accidental loss?Attempts:
2 left
💡 Hint
Think about how to save your current state safely before resetting.
✗ Incorrect
Creating a temporary branch saves your current commit reference, so you can return to it if needed after a hard reset.