Can I compact the history of a Bitbucket Cloud repo?

Fricco January 30, 2018

I have a Bitbucket Git Cloud repo that is reaching the 1Gb soft limit. There are not really big files in there (the larger is 20Mb and the following one is 5Mb, and those are not much). So I think that the size of the repo is coming from the history, as we have lot's of files that are changing frequently (some of the files may be changing more than 20 times in a day) since 2015 when we started with this repo.

Is there a way that I can compact the history of the repo to keep for example only the history up to last year? Will this help in reducing the size of it? What are the side effects of it? What is the negative side of doing it?

Can I keep the actual history (before compacted) in a separate repo so that if for some reason we need to dig to commits earlier than last year we still have a way?

Thanks in advance.

1 answer

0 votes
Ben Stuart
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2018

Hey Francisco, you can squash older commits to reduce the size of your repository and clean up the history. You can see the section Squash commits for a clean history for details on that. 

Fricco January 31, 2018

Thanks, even if this commits are already in master? What is the impact of that? Will that reduce the size of the repo?

Ben Stuart
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2018

Hey Francisco, 

You should be able to clean up the history of master with something like rebase -i. There is a good article on that in 15 Seconds to Cleaner Git History.

You must be very careful when doing so. Please head their and our warning: 

"Rebase is neat, but it’s dangerous, because it rewrites commit history. If you rebase history that is already living upstream or on other developer’s machines, you’re headed into a world of pain.

Plain and simple, do not rebase commits that you’ve already pushed (unless you are the sole developer–in that case, rebase at will and use git push -f)."

Fricco February 14, 2018

Thanks @Ben Stuart then this doesn't work for us, as we have more than 50 developers and they all have living branches that were created out of master.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events