We've a repo with 3 branches, 2 (master, develop, these are the git-flow branches for the legacy project) of which are going to be deprecated in the near future, I'd like to know if it's possible to fork the repository only for the remaining branch, which will become the "develop" branch in the new repo.
I would keep only the last N commits (i.e. 100) on the reamining branch because it's based on the legacy branches, having lots of heavy unnecesary .jar files, so I'd like also to have a lightweight repo (as every maven / gradle project should ideally be)
Thanks in advance for your thoughts,
Diego.
Hi Diego,
I'm afraid that it is not possible to fork a certain branch of a repository only or specify the number of commits you want from this branch.
One thing you can do is fork the repo, switch the main branch of the fork to "develop" from the repository Settings, and then delete the other two branches of this fork. I would also suggest contacting our support team (via https://support.atlassian.com/contact/#/) to run a git gc on the fork after you delete the branches, otherwise the commits of the deleted branches will remain on the repo as dangling commits. (I can also run a git gc if you feel comfortable sharing the URL of the repo here)
Would you need to sync the fork with the parent repo? If you won't need to sync the fork with the parent repo, another suggestion I can make is to clone only the last 100 commits of develop branch with a command like the following:
git clone repo_url --branch develop --depth 100
Then create a new repository in Bitbucket Cloud and push from that clone.
Kind regards,
Theodora
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.