The ‘git gc’ command is a garbage collector command.
The ‘git gc’ command helps in collection of garbage from a repository and ensuring optimization of the repository. Users should also ensure that the command is run periodically. The example of using the command is as follows,
$ git gc
Enumerating objects: 10060, done.
Counting objects: 100% (10060/10060), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1623/1623), done.
Writing objects: 100% (10060/10060), done.
Total 10060 (delta 4510), reused 9960 (delta 4483)