Understand the differences between BFG Repo Cleaner and git filter-repo
mainWhen migrating from BFG Repo Cleaner to git filter-repo, note these fundamental architectural and behavioral differences:
- Path Awareness: BFG operates on tree objects and only understands basenames (e.g., it cannot distinguish between
README.mdat the root vs. in a subdirectory).git filter-repooperates on thefast-exportstream, meaning it works with full paths from the repository toplevel. - Scope of Changes:
git filter-repoapplies filters toHEADby default to ensure your current working state matches the transformed history. BFG often requires manual synchronization. - Commit Metadata:
git filter-repodoes not add[formerly OLDHASH]orFormer-commit-id:footers to commit messages. Instead, it uses replace refs, which provide a cleaner way to look up commits by their original hashes. - Cleanup:
git filter-repoautomatically handles updating the index and working tree, and runs an automaticgc(garbage collection) after the rewrite. - Execution Context: BFG expects the repository path as the final argument.
git filter-repoexpects you tocdinto the repository directory before running the command.