thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

DevOps & Automation · Intermediate

git reset

A Git command that moves the current branch pointer to a specified commit, optionally changing the staging area and working tree.

Definition

--soft keeps changes staged, --mixed (default) unstages them, and --hard discards them entirely. Because reset rewrites history, it should only be used on local, unpushed commits.

Example

git reset --hard HEAD~2 discards the last two commits and their changes.

Exam tip

To undo a pushed commit safely, use git revert, not git reset.

Related terms