Progress:
TIER 3 · MODULE 13· Expert

git prune-packed

Tidies up after pack-objects.

🎯 What & why

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.

🧠 Mental model

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.

🛠️ Synopsis

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.

🎚️ Switches & options

FlagWhat it does
-n, --dry-runList what would be removed; touch nothing on disk.
-q, --quietSuppress the per-object progress output.
(implicit) packs scannedAll .idx files under objects/pack/ are consulted.
(implicit) safetyOnly loose objects with a packed duplicate are removed.

💡 Use cases

🧪 Examples

Dry-run before deleting
git prune-packed -n
Quiet sweep
git prune-packed -q
Repack then sweep
git repack -a -d && git prune-packed
Show what was packed
git prune-packed --dry-run | head

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.