Remove Files From Git History

原文链接: https://typonotes.com/posts/2023/02/06/remove-files-from-git-history/

github 官方推荐使用 bfg 进行操作, 比使用 git filter-branch 更快, 更方便

查询文件

$ git rev-list --all | xargs -rL1 git ls-tree -r --long | sort -uk3 | sort -rnk4 | head -10

https://blog.csdn.net/HappyRocking/article/details/89313501

删除文件

1
$ bfg --delete-files id_{dsa,rsa}  my-repo.git

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository

https://rtyley.github.io/bfg-repo-cleaner/