Documentation
¶
Overview ¶
blobpurge removes blobs from a repository's history BY ID, and proves what the rewrite did before anybody pushes it.
blobpurge scan [-min 512KiB] <git-dir> blobpurge strip -blob <id> [-blob <id> ...] -to <new-git-dir> <git-dir>
scan lists every blob at least -min bytes that some branch or tag reaches and that HEAD's tree no longer holds: a binary committed by mistake and deleted since, still cloned by everybody. Beside each one it names the TAGS whose trees hold it, because those are the released trees a rewrite will change.
strip writes the rewritten history into a NEW repository, so the original is untouched whatever happens, and then checks every branch and tag against it: the same refs, the same number of commits, the same authors, committers, dates and messages, and a tree equal to the old one minus exactly the stripped blobs. It does not push. Pushing a rewritten main is an act somebody takes on purpose, after reading what this printed.
It strips by blob ID, never by path, because a path names every version of a file: stripping `bridge` would also strip a later, legitimate file of that name. And it refuses a blob HEAD still holds: delete it in a reviewed commit first, so the current tree is already right before history is touched. A tree that does not hold the blob comes out byte-identical, which is what keeps the module hash of every release made after the deletion unchanged.
It replaces a `git filter-branch --index-filter` recipe whose filter was a shell script, ran once per commit, and whose only check was whatever its operator remembered to run afterwards.
The history is read through `git fast-export --show-original-ids`, which names every blob by its original ID, and written by `git fast-import`. Both ship with git. Commit signatures cannot survive a rewrite, since a signature covers the parent IDs, so they are stripped and the count is reported.