Skip to article frontmatterSkip to article content

Git Reset

Introduction to git reset

HEAD is the commit we are currently at.

A hard reset removes all not yet committed changes, which means it also removes staged changes (they are staged, not commit).

git rest --hard HEAD~1 moves HEAD to point to the previous commit, which has the effect of deleting the last commit.

git rest --hard without any refs implies HEAD in this context, therefore, it is the same as git rest --hard HEAD.

Again, a hard reset DESTROYS any uncommitted changes, be they stated or not.