how to do a hard reset in a git branch code example Example: git checkout reset hard git checkout reset HEAD~1