Since my repository size in bitbucket increased to 1GB over time, I would like to cut it and delete old history that I do not care about anymore.
I expect to cut my repository to atleast size of up to 100 mb (or atleast half of current) and have a history of 3-5 months. That means I'm OK to have less commits in my history.
This is what I have already tried and it did not work:
- running
git gc
(with flags like--aggressive --prune
). It did decrease my repo size to approximately 400mb locally. But I could not push it to remote, and therefore my BitBucket's repo size stayed the same. I tried using this method for Bitbucket garbage collection cleaning: https://stackoverflow.com/a/27868384/8610581 as well as https://stackoverflow.com/a/37253227/8610581 - I tried shallow clone (
git clone --shallow-since=<date>
and also with--depth
) which does exactly what I need. Unfortunately, I can not make a new repository out of the shallow clone (git does not allow that). - I tried reducing size of my repo by squashing many old commits into one. I did manage to get less commits in my repo, but it did not affect my repository's size (.git folder in particular) and it remained the same.
- Deleted unused and merged branches