I accidentally committed to the wrong branch. How do I delete that commit?
Use this command to delete all your work and unpushed git commits use
git reset --hard HEAD~1
And there is one more option --soft which will delete the recent commit and it doesn’t do anything to your work.