Skill 2.2.6

Remove specific data from source control

Key Concepts

git filter-repo is the recommended tool, and the BFG Repo-Cleaner is a common alternative. git filter-repo --path secrets.txt --invert-paths removes a file from all history, and --replace-text replaces values.

Rewriting changes commit IDs, so it needs a force push and everyone must re-clone. Exposed credentials must be rotated first, because they may already have been copied. Hosting services may keep cached references, so GitHub Support may need to purge them.