It’s essentially almost that even if you want to delete the commit current. Probably what you want is to return to commit previous, then need to catch the current - 1:
git reset --hard HEAD~1
If you want to go back to some other commit specific should use the hash of it. Or in some cases it can make
git reset --hard HEAD^
Try with --soft
before and see if it solves what you need. It is less radical and safer.
If the commit had already been sent will have to force on remote:
git push origin HEAD --force
This will make you lose all local changes. So if you can’t lose them, I suggest making a stash with all of them before.
If it goes wrong, you can reverse it like this:
git reset HEAD@{1}
If you’re afraid to do something wrong, do one backup before and can return to the original if it does not turn out as expected (in general this should not be necessary because the purpose of this tool is precisely this, but we know how it is...).
If you want to do it on the remote:
git push origin +HEAD^:master #ou outro nome aqui
If fear extends to the remote server, do the same to it. If involve the remote server, various precautions need to be taken, the main thing is that your branch current must be the newest of the remote. If this is not guaranteed, it will be creating an alternative reality for other users.
Recommended reading.