First the warning about dangerousness:
Rewriting your history is generally anti social. Any downstream clones of your repository will no longer be valid. Their history and your history will have diverged. That’s not impossible to recover from, but it is best if you can get everyone to push everything they’d want to push, and then clobber your history. People will just clone the repo again and have the new history and everything will be peachy.