O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required