git undo soft reset head code example Example 1: git reset soft head $ git reset --soft HEAD~1 Example 2: undo git reset HEAD~1 git reset HEAD@{1}