Spot the Reset Mistake
Find the Mistake Medium
Question
This command is meant to unstage a file. What is wrong with using --hard?
Code
git reset --hard file.txt
Hint
--hard is overkill for unstaging.
Explanation
git reset --hard discards all changes permanently — it is not for unstaging a single file. To unstage a file without losing changes, use git reset file.txt (default mixed mode) or git restore --staged file.txt. The --hard flag should only be used when you want to permanently discard everything.
Related Resources
Related Lessons
Related Cheatsheets
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.