git reset --soft HEAD~
git reset --hard <last_working_commit_id>
git push --force
# delete the last commit
$git reset –hard HEAD~
git reset --hard origin/main
git reset --hard 'xxxxx'
git clean -f -d
git push -f
git reset --hard your local branch to remove changes from working tree and index,
git push --force (or git push --force-with-lease) your revised local branch to the remote
check the full answer from here
https://stackoverflow.com/questions/3293531/how-to-permanently-remove-few-commits-from-remote-branch
$ git reset <previous label or sha1>
$ git commit -am "blabla" <--- optional
$ git push -f <remote-name> <branch-name>
git reset <previous label or sha1>
git commit -am "blabla"
git push -f <remote-name> <branch-name>
Run the following command to revert the last commit.
$ git reset --soft HEAD~
Note: You can specify multiple commits by placing a number at the end.
For instance, if we want to undo the last two commits,
we can run the following command.
$ git reset --soft HEAD~2
$git log --pretty=oneline --abbrev-commit