git gcの限度設定

リポジトリが太ってくると git gc --aggressive をやるんですがそうすると.packがかなり大きくなるので設定を入れてみた。

http://stackoverflow.com/questions/3095737/is-there-a-way-to-limit-the-amount-of-memory-that-git-gc-uses

$ git config --global pack.windowMemory 1g
$ git config --global pack.packSizeLimit 1g

この状態でgit gcやってみる。

$ du -sh .git; find .git -type f | wc -l
2.9G .git
77858

$ git gc --aggressive --prune=now
... (コーヒーブレイクしながら待つ) ...

$ du -sh .git; find .git -type f | wc -l
2.0G .git
15

$ find .git -type f | xargs ls -lh | fgrep .pack
-rw-rw-rw- 1 *** ***  916M 76 **:** .git/objects/pack/pack-6430d4f13f444f3b1e001169af98fccaf7f02154.pack
-rw-rw-rw- 1 *** *** 1022M 76 **:** .git/objects/pack/pack-f05baf59a54e65675a29e58b675dc63cf2e551b9.pack

小分けにされました。