git reset <commit>
Reset the repository or a file to a specific commit
This command is used in git to move the HEAD
pointer to a specific commit snapshot, effectively 'undoing' all commits up to that point.
It doesn't delete the commits, but it does move the HEAD
, and optionally the branch pointer, to point at a previous commit. This makes it appear as if those commits never happened from the current branch's point of view.
<commit>
can be replaced by any valid commit hash. A variety of flags can add more capabilities to this command, such as --soft
, --mixed
, and --hard
, modifying the state of the staging area and the working directory to match the specified commit.