undo commit without losing changes 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