要清除该库的历史,你可能会考虑新的工具,git filter-repo它取代了BFG和git filter-branch。
git filter-repo --strip-blobs-bigger-than 10M --refs master~3..master
Run Code Online (Sandbox Code Playgroud)
将 3 替换为您拥有的未推送提交的数量(仅供参考:查看未推送的 Git 提交)。
或者:
git filter-repo --strip-blobs-bigger-than 10M --refs origin/master..master
Run Code Online (Sandbox Code Playgroud)
请注意,如果您Error: need a version of git whose diff-tree command has the --combined-all-paths option在运行上述命令时收到错误消息,则表示您必须更新git.