Can I compact the history of a Bitbucket Cloud repo?

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 Jan 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. 

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 Feb 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)."

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
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

701 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you