How to remove committed secrets from a git repository
Imagine you are working in the next feature for the main app of your employer and suddenly you notice something terrible: there is a hardcoded secret committed in the remote repository. This is something we must avoid at all costs because anyone with access to that repository can see the secret and potentially use it to access live data or bring the system down.
After some investigation, you notice that the commit that introduced the secret is quite old, and lots of new commits have been added since then.