git reset HEAD ~1 code example
Example 1: "git reset –- soft head^"
git reset --soft HEAD^ #The command to undo a commit and reset to the commit before HEAD and keeping the changes is:
Example 2: git reset head
sudo git reset --hard Head
Example 3: undo git reset HEAD~1
git reset HEAD@{1}