The commit looked clean. The rebase went through without a hitch. But hidden in the rewritten history was a secret that should never have left your machine.
Git rebase can rewrite commits, squash changes, and clean up history. It can also expose sensitive data if you’re not careful. When you replay commits, secrets—API keys, passwords, tokens—can slip into a new commit or linger in an old one you didn’t mean to keep. Once pushed, they’re in the remote. Even if you force-push, the data may survive in clones or caches.
Secret detection in Git rebase is not optional. You need to scan each commit before it leaves your machine. That means checking both the rewritten commits and the original ones. Tools without native rebase-aware scanning will miss secrets hidden in the rebase base tree or interactive edits. A proper detection process inspects every commit object created during the rebase, not just the diff of the HEAD.