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