how to revert reset head code example Example 1: git reset head sudo git reset --hard Head Example 2: undo git reset HEAD~1 git reset HEAD@{1}