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 vote
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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Color tables for a shiny Confluence page

...; ## Developed by: Alana Fernando ## Shared with love ## @param style:title=style type|type=enum|required=true|desc=Choose a style.|enumValues=Style1,Style2,Style3,Style4,Style5 ## @param alignment:title...

169 views 8 11
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