Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to fork a repository but only one branch? Edited

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.

1 answer

0 votes

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Bitbucket Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

391 views 9 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you