I'm currently working on a project that is mainly made of very small files, which means the current project's size is very small (< 1 MB) and the history should be pretty small as well.
But when checking the .git
folder's size, I saw it was a whopping 17 MB!
So I investigated a bit with the following one-liner (taken from this answer):
git rev-list --objects --all |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
sed -n 's/^blob //p' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
Which shown that I had a set of large HTML, JS and JSON files taking up all the space. Which is weird, as I only have Markdown files here (it's a documentation repository).
So I took one of the reference's ID, run git show <ID>
and it displayed a deploy entry from Github Pages!
The weird thing is that I don't have the gh-pages
branch locally, only the main
one which does not have any single HTML/JS/JSON file in it (I checked the whole history).
But I have some references of deployments with the changes on each HTML / JS / JSON file.
So my question is: why does that happen, and how can I get rid of all these useless informations that I don't want to have locally?
Thanks in advance for your help!
EDIT: To be clearer, I do not have the gh-pages
locally. If I try to git checkout
it I get an error telling me it doesn't exist. If I check out origin/gh-pages
it works and creates a local branch but barely increases the .git
size (less than 1 MB more) despite this branch containing a lot of data.