I have an old mercurial repository that I am exporting to git using hg-fast-export. It is 115MB. When I run hg-fast-export as described here, the resulting git repository is 663M. Any idea why that would be?
Asked
Active
Viewed 189 times
2
-
I don't know what the mercurial import script does, but try running `git gc` or `git repack` (there are a variety of options to each you may need to experiment with) to see if that shrinks things. – Andrew C Dec 04 '14 at 16:42
-
git repack said there was nothing to pack. git gc made it 100MB bigger... – Colton Leekly-Winslow Dec 04 '14 at 16:51
-
`git repack -a -d --depth=250 --window=250` is my normal repo shrinking command. Depending on what the import script did you may have extra refs and/or reflogs that need to be cleaned up first. But you can try the `repack` first. – Andrew C Dec 04 '14 at 16:54
1 Answers
2
The answer was
git gc --agressive
which I actually got from an article where Linus Torvalds said it was a bad idea but his command didn't work and this one did.
http://metalinguist.wordpress.com/2007/12/06/the-woes-of-git-gc-aggressive-and-how-git-deltas-work/
I also had to change the memory usage parameters for packing, as described here:
Is there a way to limit the amount of memory that "git gc" uses?
![](../../users/profiles/-1.webp)
Community
- 1
- 1
![](../../users/profiles/4237075.webp)
Colton Leekly-Winslow
- 643
- 6
- 13