QuestionQ100

VerifiedDevOps Fundamentals

Which Git command resets the current branch to its preceding commit and removes all uncommitted changes?

Explanation

git reset --hard HEAD~1 moves the current branch back to the commit immediately before HEAD and makes the staging area and working tree match that commit, discarding uncommitted changes.

Community Discussion

No comments yet. Be the first to start the discussion!