We have a large bitbucket repo (1.89 GB) that our engineering team needs to reduce to continue to use the repo on Bitbucket cloud.
The goal is to reduce the size of the current repo by removing old commits and history.
The trick, we can not loose the commit history so we have a secondary repo, where we can move the old history or the new commits to.
Trying to figure out the best option to do this.
Option 1:
- we clone the repo locally, reduce the size of the repo then push the reduced to the new location and make this our new repo to push code to https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html
Not ideal as many users already have the current repo set up in Sourcetree
Option 2
- Create a new repo, clone the current repo, push it to the new repo as a archived repo
- Reduce the history of the local repo using the documentation in the above link, push it back to current remote repo
Option 3
- Clone the repo locally, run git commands if they exist to split it into two local repo based on commit history, i.e. keep the last 4 commits only, everything else goes into a new repo
- Push the current commits to the current remote repo
- Push the old commits to the new repo
This option is more ideal but seems very close to option two, but wanted to see if there are git commands people are aware of to do option 3?