Git/Garbage Collection

aus www.kruedewagen.de, Homepage von Ralf und Judith Krüdewagen (Kruedewagen)
< Git
Version vom 14. Januar 2014, 10:03 Uhr von Rkr (Diskussion | Beiträge) (Rkr verschob die Seite Git/GC nach Git/Garbage Collection)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

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