Git Garbage collection doesnt seem to fully work

前端 未结 1 1361
你的背包
你的背包 2020-12-05 05:03

I\'m a little confused as how to completely clean out my garbage...

git count-objects -v -H

warning: garbage found: ./objects/pack         


        
相关标签:
1条回答
  • 2020-12-05 05:49
    C:\Users\VonC\prog\git\git>git log -Ssize-garbage|more
    

    This show the size-garbage output has been introduced in commit 1a20dd4 by Nguyễn Thái Ngọc Duy (pclouds) for git 1.8.3 (May 2013)

    size-garbage: disk space consumed by garbage files, in KiB

    count-objects: report how much disk space taken by garbage files

    Also issue warnings on loose garbages instead of errors as a result of using report_garbage() function in count_objects()

    This garbage cleaning tip section mentions:

    To bring the repo size down the bare minimum, you need both the following commands (neither command by itself does the whole job).
    Also Note the lowercase "a" on the "repack", which says you want to blindly discard unreachable objects instead of keeping them as loose objects.

    git repack -adf     # kills in-pack garbage
    git prune           # kills loose garbage
    

    So try again the git count-objects -v -H after applying both commands.


    Looking at the git repack man page, jthill adds in the comments:

    I prefer the big-A option:

    "Same as -a, unless -d is used.
    Then any unreachable objects in a previous pack become loose, unpacked objects, instead of being left in the old pack."

    Linus Torvalds argues that -f like gc's --aggressive is much overused -- so much so he suggested yanking the documentation for it.
    (in 2007)
    (-f is for --no-reuse-delta)

    That means a more efficient combination might be:

    git repack -Ad      # kills in-pack garbage
    git prune           # kills loose garbage
    
    0 讨论(0)
提交回复
热议问题