git reset

Undo commits or unstage changes, by resetting the current Git HEAD to the specified state. If a path is passed, it works as "unstage"; if a commit hash or branch is passed, it works as "uncommit". More information: https://git-scm.com/docs/git-reset.

git reset

git reset path/to/file1 path/to/file2 ...

git reset --patch path/to/file

git reset HEAD~

git reset --soft HEAD~2

git reset --hard

git reset --hard commit