git刪除歷史中的大檔案

列出歷史中的大檔案

1
2
3
4
5
6
git rev-list --objects --all |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
sed -n 's/^blob //p' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest

https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history

刪除大檔案

https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-the-git-repository

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

遇到protect branch

1
--no-blob-protection

https://stackoverflow.com/a/47421624

遇到 [remote rejected] 錯誤

https://stackoverflow.com/a/74373146

Author

Steven

Posted on

2023-06-30

Updated on

2025-01-14

Licensed under

Comments