I wiped an entire column of customer data by mistake, and it was already in git.
The commit was clean. The tests passed. But the branch was poisoned with sensitive fields that should have never been there. The problem with sensitive columns in source control is that they spread. Every clone, every branch, every pull. Once they land in the history, they're permanent unless you cut them out.
Git reset is not enough. You must remove the sensitive columns from every commit they touched, and you must do it without breaking the integrity of your codebase. This means rewriting history, not just rolling back.
The fastest way is using git filter-repo or the old git filter-branch. Identify the column or key—let’s call it ssn—and strip it from all revisions. This is not just about redacting; it’s about deleting it from the repository’s DNA. Every commit that contained that column must be rewritten, and any collaborator must re-clone from scratch once you force push the cleaned branch.
Here’s the clean kill in git filter-repo: