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).
|--aggressive (take extra time to save even more space)|
|--prune (delete unused objects)|
To aggressively repack the current repository and save as much space as possible:
git gc --aggressive --pruneGenerating 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.