What does `git filter-branch` versus `git filter-repo` do, and which should you use?
AdvancedConceptHooks, submodules, LFS and signing
Answer
Both rewrite history, for example to remove a file or change author data. filter-branch is slow, error-prone and officially discouraged. git filter-repo (separate Python tool) is fast, safe by default (works only on fresh clones) and is the recommended replacement. BFG Repo-Cleaner is a simpler alternative for removing files or secrets.
git filter-repo --invert-paths --path secrets.json
More on Hooks, submodules, LFS and signing
What are Git hooks and where do they live?BeginnerHow do you share hooks with a team, given `.git/hooks` is not committed?IntermediateWhat does the `commit-msg` hook receive and what is it good for?IntermediateWhat do `pre-receive` and `update` hooks do and how do they differ?AdvancedWhat is a Git submodule?BeginnerWhy do submodules confuse people and what are the common pitfalls?Intermediate