Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Git's repack --drop-filtered reclaims the disk a partial clone quietly took back

说明与用途

git repack --drop-filtered 可从部分克隆中删除 promisor 对象,节省磁盘空间并避免不必要的网络请求,但如果任何被过滤的对象在索引中被引用,则会中止。

问题

Partial clones with --filter=blob:limit keep promisor objects that grow the .git directory and are not cleaned up by normal housekeeping, causing disk bloat and costly refetches.

结果

git repack --drop-filtered efficiently removes promisor objects from partial clones, reclaiming disk space and preventing unnecessary network fetches, but it aborts if any filtered blob is referenced by the current index.

工作流

  • Clone repo with --filter=blob:limit=1m
  • Perform history traversal (e.g., detached checkouts)
  • Run git repack -a -d --filter=blob:limit=1m --drop-filtered
  • Verify .git size and asset integrity
  • Optionally switch back to main to refetch needed assets

证据

git repack --drop-filtered was merged on 25 August 2026. It is not in 2.55.0 — I checked the tag — and it is on course for 2.56

来源

120 blobs gone in 36 milliseconds. The documentation says it rebuilds the promisor pack without those objects and then deletes the now-redundant old packs

来源

fatal: cannot drop 'assets/asset1.bin' (6ee0d39165f32c48d1236fb18eb1b2dd5c94f712): it is referenced by the current index

来源

  • 记录日期: 2026-09-15T11:30:55.109Z