Tidies up after pack-objects.
git prune-packed deletes loose object files from .git/objects/xx/ whenever an identical object already lives inside a packfile. It is the tidy-up step that follows a successful git pack-objects or git repack.
Loose objects are one file per object; packfiles are bundles. Once an object is safely inside a pack, the loose copy is dead weight. prune-packed is the broom that sweeps that dead weight away.
git prune-packed [-n | --dry-run] [-q | --quiet]
No revision args, no path args. It walks `.git/objects/??/` and removes any loose object whose SHA is also present in a pack index.| Flag | What it does |
|---|---|
-n, --dry-run | List what would be removed; touch nothing on disk. |
-q, --quiet | Suppress the per-object progress output. |
(implicit) packs scanned | All .idx files under objects/pack/ are consulted. |
(implicit) safety | Only loose objects with a packed duplicate are removed. |
git repack -a -d that left loose duplicates.git gc.-n) what a future GC pass will throw away.git prune-packed -ngit prune-packed -qgit repack -a -d && git prune-packedgit prune-packed --dry-run | headgit gc for normal use; prune-packed is for scripted, surgical cleanup.-n first if you are unsure which objects are about to vanish.repack -a (not -A) to recover space promptly.git prune for that.repack on a busy repo can race; quiesce writers first.-n the deletion is immediate and unrecoverable from the working tree.Hit each option, then Check answers. Score is recorded; Next is always open.