undo last commit without losing changes and no hstory code example
Example 1: reset last commit without losing changes
git reset HEAD~1 --soft
Example 2: remove the last commit git without losing changes
git reset HEAD~1 --soft
git reset HEAD~1 --soft
git reset HEAD~1 --soft