Skip to content

Reset

← All terms · Git fundamentals

A command that permanently moves the current branch pointer backward to a previous commit, effectively erasing the commits that came after it from the branch's history.

What it is

Reset rewrites local history by moving the HEAD pointer to an older commit. Depending on the mode used (soft, mixed, or hard), it can leave your modified files in the working directory, stage them, or completely delete the uncommitted work. It should rarely be used on shared remote branches.

When you would use it

You use reset when you've made a terrible mistake locally and want to pretend the last few commits never happened, starting fresh from an older state.

Common operations

  • Completely discarding local experimental code (hard reset).
  • Un-committing recent changes to rewrite the commit history locally (soft reset).

Related terms

Where this is taught

No learning path uses this term yet. Browse the Learning Atlas for guided sequences through related ideas.

Going deeper