Press .
on a repo webpage to open it in github.dev, go to the terminal, click on the btn to open GitHub Codespaces, click on the option 2 cores, 8 GB RAM, 32 GB storage
,
open the terminal there, copy & paste the following (it will show the pending change and asks you to confirm before it deletes the previous commit entirely, even from history):
git reset --hard HEAD~1
git push origin -f