git repack
Administration
Pack loose objects into packfiles
The 'git repack' command combines loose objects (one file per object) into packfiles — compressed files that store similar versions as small deltas. Packed repositories are much smaller and faster. git gc calls it for you; running it directly is for fine-tuning.
Synopsis
git repack [-a] [-d] [-f] [--depth=<n>] [--window=<n>][ ] optional| or<arg> placeholder... repeatable--flag option
Examples
Pack everything, drop old packs
git repack -a -dOne tidy packfile.
Workflow Examples
1
git count-objects -vLoose count and size
2
git repack -a -dPack
3
git count-objects -vLoose objects are gone
Troubleshooting
Repacking takes very long
Cause: --aggressive or large --window on a big repository
Use the defaults via git gc
Tips & Pitfalls
Best Practices
- ✓Prefer git gc unless you know why you need repack options.
FAQ
A:
Yes, it never removes reachable objects.