I am sure some of you, like me, have cloned a repository and experienced the long wait time to copy data locally with a fast computer and fast internet.
The repository might have large Git packfiles .git/objects/pack
which surpass 1G in size.
Digging a little deeper, you might find that this might be caused by blob files: assets in the repository.
While not necessarily a bad thing, some of these files might be better off in another repository, since they do not appear necessary to run or deploy the app.
In the meanwhile, to save a little time, you can always shallow copy (0m49.415s on my computer):
# Shallow clone staging
git clone \
--branch staging \
--single-branch \
--shallow-since='1 days' \
[email protected]:<my-username>/<my-repo>.git
# List all file sizes in descending order from the current directoy
du \
--human-readable \
--max-depth=1 "$PWD" \
| grep --extended-regexp 'K|M|G' \
| sort --human-numeric-sort --reverse
3.1G /Users/eddie/repos/code
2.1G /Users/eddie/repos/code/.git
496M /Users/eddie/repos/code/analytics
162M /Users/eddie/repos/code/app
94M /Users/eddie/repos/code/marketing
...
# List files with png extension, and include a total
find . -name "*.png" -print0 | xargs -0 du -sch
...
208M total
Some files types to consider:
Extension | Size |
---|---|
png | 221M |
jpg | 96M |
jl | 54M |
mp4 | 27M |
gif | 18M |
13M |