How does git force the local old version of code to push to the remote and overwrite the remote new version of code

  git, question

For example, there is a scenario where I clone a code from git, then accidentally delete it all locally, then add, commit, and push it to the remote library. now the remote library has been emptied due to my mistake.
So now the problem comes, for example, the current version number is aaaaa and the correct code version number is bbbbb. Even if I can use gitreset-hardbbbbb to go back to the previous correct version locally, I can’t push to the remote, which will pop up the error that the local version is lower than the remote version. In this way, I have to pull first, but as soon as I pull the local code is empty again. . . .
Is there any way to force the old version of the code to push to the remote and overwrite the remote new version of the code?

Then if I successfully restored the remote code, is it possible to have any influence on my teammates? . .

Git push -f mandatory submission