como desfazer commit

C++
git reset # commitId
# Exemple
git reset 5310517

Source

Also in C++: