Git - Undo

Checkout a file, discard any uncommitted change and stay on the same branch:

git checkout -- index.html

Checkout a file from an older commit:

git checkout abcdef123456 -- index.html

Unstage a file:

git reset HEAD index.html

Amend last commit, reusing it without creating a new commit:

git commit --amend -m "test"

Reset HEAD to specified commit:

git reset --hard abcdef123456

Reset HEAD to specified commit, the changes are on staging area and need to be committed:

git reset --mixed abcdef123456

Reset HEAD to specified commit, the changes are on the FS to be staged and committed:

git reset --soft abcdef123456