How to use git repack -a -d --depth=250 --window=250

后端 未结 2 1574
既然无缘
既然无缘 2021-02-04 03:18

I\'ve seen git gc --aggressive --prune and git repack -a -d --depth=250 --window=250 recommended for reducing the size of your local .git folders where

2条回答
  •  忘掉有多难
    2021-02-04 03:42

    I ran some tests with different values. This is too large to be a comment on twalbergs answer.

    My company has a code base that has been in svn, mercurial, and now git. It is 10 years old, with 21,000 commits.

    Before the pack it was 3.1 GB. After the repack, it shrunk to the following values:
    (running the repack on a fresh clone of the 3.1GB folder each time).

    git repack -a -d --depth=50 --window=10 -f
    141.584 MB
    
    git repack -a -d --depth=250 --window=1000 -f
    110.484 MB
    
    git repack -a -d --depth=500 --window=1000 -f
    110.204 MB
    

    They took about 5, 15 and 30 minutes respectively on my quad core mac.


    Update:

    I took the second repack (250,1000) and reran the repack with 500, and 1000 to see if there is any difference between a fresh 3.1gb repo and an already repacked 110mb repo.

    git repack -a -d --depth=250 --window=1000 -f
    110.484 MB
    git repack -a -d --depth=500 --window=1000 -f
    110.212 MB
    

    Verdict: the repack 500, 1000 resulted in a 110.2 MB file regardless if it had already been packed or not.

    Update2:

    I was further curious if running a repack with lower values on an already repacked repo would cause the size to increase.

    git repack -a -d --depth=500 --window=1000 -f
    110.204 MB
    git repack -a -d --depth=50 --window=10 -f  
    142.056 MB
    

    Verdict: the repack caused the repo size to balloon back up to ~140 MB from 110 MB

提交回复
热议问题