xxxxxxxxxx
git reset --hard HEAD~0
will go to latest commit.
git reset --hard HEAD~1
will go to last but one commit.
Note: Be careful while running this command. it can't be irreversible
xxxxxxxxxx
# reset to specefic commit
git reset --hard <commit id>
# to go back one step
git reset --hard HEAD~1
# note: use --soft to keep file changes
xxxxxxxxxx
# rollback to commit state
git revert --no-commit 0766c053..HEAD
git commit
xxxxxxxxxx
# This will detach your HEAD, that is, leave you with no branch checked out:
git checkout 0d1d7fc32