Here’s a quick tip which lets you to delete your last commits which are not pushed yet.
To delete last unpushed Git commit, without deleting your changes, run the following command.
git reset --soft HEAD~1
To delete last unpushed Git commit along with the changes you have made, run the following command.
git reset --hard HEAD~1
Useful Read: How to set Git to ignore chmod changes