Here’s an example of how to remove every *.pyc file from every commit in Git history. It is adapted from this Git help page.
Rewrite history
Run git filter-branch
, forcing (--force
) Git to process—but not check out (--index-filter
)—the entire history of every branch and tag (--tag-name-filter cat -- --all
), removing the specified files ('git rm --cached --ignore-unmatch *.pyc'
) and any empty commits generated as a result (--prune-empty
). Continue reading Remove Unwanted Files From Git History