Step-by-Step Tutorial
What This Does
Removes sensitive files from a public GitHub repo AND scrubs them from the entire git history so they can’t be recovered from old commits.
The Prompt
I need to clean up the public GitHub repo - found some private data that shouldn't be there.
Remove it and make sure it's gone from the git history too.
What Claude Does
- Creates an allowlist-style .gitignore (ignore everything except deploy files)
- Removes files from current git tracking
- Installs BFG Repo-Cleaner
- Clones a mirror of the repo
- Runs BFG to scrub files from entire history
- Force pushes the cleaned history to GitHub
- Lists all other public repos and makes them private (because why were 28 repos public anyway?)