3

I have a git repo online with BitBucket. It's approx. 31 MB in size. I decided to move it to a new location. So I created a new remote repo, an empty one.

I then cloned the old repo onto my computer, changed the remote URL (in .git/config) to the new location of the empty repo I just created, then I checked out all the branches with this line of code:

for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done

After that finished, I ran:

git push --all

After all that uploaded, I checked the new repo and as expected, all the source seems to be there, and all the branches too.

But the new repo is only 8.5 MB in size.

All my content seems to be there, but something must have got forgotten to give me over 20MB of freed space.

What may have gone missing in the process?


Details

Cloning my "slim" repo, here are some stats, running git count-objects -v:

count: 0
size: 0
in-pack: 4727
packs: 1
size-pack: 7998
prune-packable: 0
garbage: 0

A fresh clone of the original repo gave me this:

count: 0
size: 0
in-pack: 4727
packs: 1
size-pack: 7945
prune-packable: 0
garbage: 0

size-pack is actually smaller from the original 31MB repo

Just to clarify, when I say the size is different, on disk I have 18.8MB vs 18.7MB, but online at BitBucket the overview page is reporting 31MB vs 8.5MB. Does that change something?

Daniel
  • 23,129
  • 12
  • 109
  • 154
  • Of the 31 MB, how many were binary files? Could it be that git is storing more binary deltas, and less of the actual files? – Dmitri Oct 09 '12 at 18:29
  • There are a few hundred UI images (standard and retina). The size of the containing folder of these images is 1.6MB. I suppose it could have kept track of numerous deltas. But why would that not have got pushed onto the new repo? – Daniel Oct 09 '12 at 18:40
  • Daniel, I wish I could answer your question. But where I would start is running du -hc and/or diff on the two repos and comparing the output. Also, perhaps running "git count-objects -v" on the old repo, and seeing how many garbage objects it found may clear up some of the mystery. – Dmitri Oct 09 '12 at 19:19
  • Hi @Dimitri I added some details following your suggestions. – Daniel Oct 09 '12 at 20:38
  • Sorry, Daniel, I'm out of obvious ideas :) If you figure it out, please be sure to post. – Dmitri Oct 09 '12 at 22:20

2 Answers2

1

Try running git gc on your local repository, it might get smaller without losing anything. (except garbage :D)

Niko Sams
  • 4,304
  • 3
  • 25
  • 44
1

There is a Git Tip on How to compare two local repositories:

Or maybe this will help: Getting the difference between two repositories

Community
  • 1
  • 1
Dmitri
  • 2,658
  • 2
  • 25
  • 41