Name
gc
Synopsis
git gc [--prune] [--aggressive]
Pack the .git/objects directory to save disk space and increase speed.
git gc is run automatically from time to time, so it is rarely needed unless you want to use the --prune or --aggressive options or want to force packing to happen at a particular time (such as before making a backup).
Options
--aggressive (take extra time to save even more space) |
--prune (delete unused objects) |
Examples
To aggressively repack the current repository and save as much space as possible:
$ git gc --aggressive --prune
Generating pack...
Done counting 3299 objects.
Deltifying 3299 objects...
100% (3299/3299) done
Writing 3299 objects...
100% (3299/3299) done
Total 3299 (delta 2225), reused 0 (delta 0)
Pack pack-4eb8f89a145f826ef93923fe97c4ab23bd8abb62 created.
Removing unused objects 100%...
Done.
Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.