Swift Repository Size

Hello everyone,

Recently development in the compiler is a bit tricky depending on the hardware setup we have, in this case a 256GB SSD disk, has caused constantly running into can't write to output file (No space left on device) when trying to build things.
Have been workaround it with clean mymac which is awesome to free a few GBs here and there, and attempted a few git clean ups as well such as git repack, git gc and so on... after found that the biggest offender is llvm-project git objects. See bellow:
Screenshot 2023-02-08 at 00.05.56

So the goal of this post is just to raise the topic and get ideas on how to improve that.
Maybe someone with a more extensive knowledge of git can share some trick to reduce the size of local .git folder?
One of the things I was thinking is that if people are not interested in the llvm project we could have an option to download the pre-build binaries with debug symbols instead of fetch the project with git repo. Or maybe another way to fetch the repo that don't need the whole git information.
Any ideas are welcome!

cc @contributor-experience-workgroup As although this is sort of an infra topic, it also can be in some way a barrier for contribution.


If you don’t need the history, you can try using a shallow clone to save space.


Similar post on llvm-project forums:


I've never seen the LLVM git checkout take that much space and I mostly use it on smaller storage. Checking the space on my Android phone now, it says 3.2 GB for .git and 4.7 GB for the whole directory with two remotes added: the Apple original and my github fork. Of course, I checked it out manually with git clone, not with update-checkout, not sure if that is doing something extra.

1 Like

update-checkout has --skip-history. We could add an analogous flag for the LLVM monorepo specifically. But something must have gone wrong here. My llvm-project clone is around 2 years old and the .git directory weighs under 4GB β€” still a lot, but 137GB!? Have you tried re-cloning it?


Thanks everyone for the answers!

Thanks @anthonylatsis, indeed re-cloning it did make it 3.14GB. But I really don't know how or what made it into this 137GB state

I have seen a git repository growing to several times its original size in the past as well where nothing but a fresh clone reduced its size again. My assumption is that this is a Git bug and if you still have that gigantic checkout of llvm-project, it might be worth reporting it.

1 Like

Another option to recloning might be to try repacking the repository, so something like this:

git repack -a -d -f --depth=250 --window=250

on the largest (or all the) repositories might help.

1 Like