how to restore commit version code example Example 1: reset last commit $ git reset --soft HEAD~1 Example 2: how discharge changes e recover last commit git git clean -fd