git/filter-branch

Rewrite History

Rewrite branches to filter out some files or modify commits

git
filter
history

Command

git filter-branch

Explanation

git filter-branch is used to rewrite branches to filter out some files or modify commits. It rewrites the branches to filter out the files or modify the commits.

Examples

Remove file from history

git filter-branch --tree-filter "rm -f secret.txt"