FahamLah

Commands

git filter-repo --sensitive-data-removal --invert-paths --path

git filter-repo --sensitive-data-removal --invert-paths --path <file>

Risk: Can lose work

What it does

Rewrites history, for example to wipe a file from every commit. A separate tool you install.

When to use it

After a secret leaked, and only after you rotated the key.

Example

$ git filter-repo --sensitive-data-removal --invert-paths --path .env

Wipe .env from all history. Every later commit id changes.

$ git filter-repo --sensitive-data-removal --replace-text ../secrets.txt

Replace secret text listed in a file, in every commit.