git-filter-branch
Rewrite branch history by applying filters
TLDR
Remove file from history
SYNOPSIS
git filter-branch [options] [--] [rev-list]
DESCRIPTION
git filter-branch is a powerful but deprecated tool for rewriting Git history by applying filter commands to every commit in a branch. It walks through the entire commit history, allowing modifications to trees, commit messages, author information, or other metadata.
The subdirectory-filter is particularly useful for extracting a subdirectory into a new repository with its history intact. Performance is notably poor on large repositories because it must check out every commit's tree. This limitation led to the development of git-filter-repo as the official replacement.
PARAMETERS
--tree-filter cmd
Rewrite tree and contents.--env-filter cmd
Modify environment.--msg-filter cmd
Rewrite commit messages.--subdirectory-filter dir
Extract subdirectory.--prune-empty
Remove empty commits.-f, --force
Force overwrite backup.
CAVEATS
Officially deprecated in favor of git-filter-repo. Slow on large repositories. Changes history, invalidating commit hashes and requiring force pushes. Collaborators must reclone. Creates backup refs that must be manually cleaned.
SEE ALSO
git-filter-repo(1), git-rebase(1)
