Git 縮減倉庫 優化 Git 倉庫大小 提高性能
sh
# 清除垃圾文件 - 大量無用的 mp3 文件
git filter-repo --path-glob '*.mp3' --invert-paths --force
# 列出標籤和分支,刪除不需要的
git tag -d <tag_name>
git push origin --delete <tag_name>
git branch -d <branch_name>
git push origin --delete <branch_name>
# 清理垃圾回收並重新打包對象
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git repack -Ad
git prune
# 推送修改後的歷史記錄回遠程倉庫
git remote add origin <https://github.com/username/repository.git>
git push origin --force --all
git push origin --force --tags