git revert commit without deleting changes visual studio 2019 code example Example: reset last commit without losing changes git reset HEAD~1 --soft