Reset HEAD
to the last commit that you want to keep. There are three steps to reset:
- Reset refs: The repo pointer is moved to the passed commit SHA. (
--soft
only does this) - Reset stage: The staged files are moved to working directory. (
--mixed
does this too) - Reset working directory: The files in the working directory are reset. (
--hard
does all three)
Default: --mixed
Then force push.
git reset xxxxxxxx9819d19b6cb6185d107c565b4d5ba1d7
git push --force