git reset Reset current HEAD to the specified state.

git reset <commit-hash> <filename> Revert a file to a particular commit.

git reset <filename> Remove a file from a pending commit (undo ''add'').

git reset —hard <commit> Resets the index and working directory. Any changes to tracked files in the working directory since <commit> are discarded.

git reset HEAD <file> Unstage a file to be committed.

git reset —soft Moves HEAD, and only the HEAD. It doesn't create a new commit, and it can actually move HEAD to any commit. Changes remain staged.

Facts, Thoughts and Opinions


  •   Subtopics

  •   Writings

  Sources & Bookmarks