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

  1. Creates an allowlist-style .gitignore (ignore everything except deploy files)
  2. Removes files from current git tracking
  3. Installs BFG Repo-Cleaner
  4. Clones a mirror of the repo
  5. Runs BFG to scrub files from entire history
  6. Force pushes the cleaned history to GitHub
  7. Lists all other public repos and makes them private (because why were 28 repos public anyway?)