reset hard without loosing stash code example Example 1: git reset --hard one step git reset --hard HEAD~1 Example 2: git checkout reset hard git checkout reset HEAD~1