1

My local repo is huge! but when I do a fresh clone its only ~5GB

When I run

$ git count-objects -vH

I get

warning: garbage found: .git/objects/pack/pack_git2_a00484
[many lines like this]
warning: garbage found: .git/objects/pack/pack_git2_c11896
count: 0
size: 0 bytes
in-pack: 38993
packs: 4
size-pack: 1.28 GiB
prune-packable: 0
garbage: 206
size-garbage: 42.19 GiB

and

git fsck --full --unreachable

Is showing lots of unreachable commits and blobs

I've tried many different commands including

git repack -Ad
git reflog expire --expire=now --all
git gc --aggressive --prune=now

but nothing is actually getting cleaned up.

How can I clean up my current repo to be the same as a fresh clone?

DontPanic345
  • 380
  • 3
  • 13
  • "Only" 5 GB? That's pretty huge. Have you considered [git-lfs](https://git-lfs.github.com/)? – Schwern Oct 28 '16 at 04:17
  • 1
    This question isn't a duplicate of the one marked, and I've clearly stated that I've tried the answers given in the duplicate and they didn't work for me. But lets not anger the Q&A Nazis. – DontPanic345 Oct 30 '16 at 21:59
  • And yes at some point we will be adopting git-lfs, but first we need to get a server that can run it – DontPanic345 Oct 30 '16 at 22:00
  • SO to the rescue, right? This is clearly not actually a duplicate and Google marks this as the top answer ... so there's that. @DontPanic345, did you ever get an answer? – Jaime Mar 22 '18 at 17:42
  • Sorry @Jaime I don't think I ever did get a solution. I just pushed all my branches, deleted the whole local repo and cloned it again. – DontPanic345 Mar 24 '18 at 02:50

1 Answers1

0

How about git prune. (e.g. git prune -v)

kaitoy
  • 1,545
  • 9
  • 16