Git Reset Hard
Multiple Choice Medium
Question
What does git reset --hard do?
Hint
--hard discards all changes.
Explanation
git reset --hard <commit> moves the branch pointer to the specified commit AND discards all changes in the working directory and staging area. This is destructive — uncommitted changes are lost forever. Use --soft to keep changes staged, or --mixed (default) to keep changes unstaged. Always be cautious with --hard.
Related Resources
Related Lessons
- Git Reset
Learn git reset.
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.