How to optimize a Git repository

Run the following command:

	 git gc

The command optimizes the current Git repository and removes unneeded files. The ouput shows the statistics of the process:

$ git gc
Counting objects: 10125, done.
Compressing objects: 100% (1689/1689), done.
Writing objects: 100% (10125/10125), done.
Total 10125 (delta 4530), reused 9895 (delta 4300)

References:

Git