Zum Inhalt springen

Git/Garbage Collection

aus www.kruedewagen.de, Homepage von Ralf und Judith Krüdewagen (Kruedewagen)
< Git

In order to save disk space and to improve the overall repository processing performance you should run following command from time to time (also on bare remote repositories):

git count-objects -v
git gc
git count-objects -v

This packs multiple objects into one file. If you clone a project (from remote) the server packs the files automatically, but that local copy becomes fragmented over time (and so also the remote).

As script:

DIR="/data/git/"
cd $DIR
REPOS="repo1 repo2 repo3"
for i in $REPOS; do
 cd $i
 git gc
 cd $DIR
done