← Quiz: Undoing Changes: all 10 questions
Quiz: Undoing Changes · Question 8 of 10
What does git reset --hard HEAD~1 do?
What does git reset --hard HEAD~1 do?
- A.Creates a new commit undoing the last one
- B.Moves the branch back but keeps changes staged
- C.Moves the branch back one commit and discards that commit's changes from your files
- D.Deletes the remote branch
Answer & explanation
Correct answer: Moves the branch back one commit and discards that commit's changes from your files
--hard also resets the staging area and working directory; use it with care.
Can you get the rest right without peeking?
Take the timed Quiz: Undoing Changes quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →