git config --global alias.uncommit 'reset --soft HEAD~1'
This will create a global Git alias called
uncommit that reverts the current repository’s last commit using soft reset and puts the changes back into the staging area.
So, if you want to undo your last commit, you can do it like so.
Bonus: While you’re here, you can list down all the Git aliases you have created using the following command.
git config --list | grep alias