Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Creating branch inside a branch

Hello, I have a situation where I need to maintain files that are highly categorized. Basically I am using BitBucket to store Test scripts related to multiple modules, this how it looks on a high level:

  1. A Git Project with my team name
  2. Many repositories for each Projects of my Organization
  3. Many branches inside each repository for different modules of a project

Now my issue comes where I need to further categorize many test scripts that I would like to maintain under these branches:

Suppose I have 5 different functionalities and I have written 5 test scripts. Each of the functionality is independent of each other, but comes under the same module. Therefore I will somehow have to keep the test scripts under the same repository, but still need to have a kind of separation. Because I do not want to pull all the remaining 9 test scripts if I wanted to modify one of them (This occurs if I keep all 10 test scripts under the same module branch).

Therefore I would like to create branches inside a branch to avoid checking out all other scripts. But when I did create a branch inside a branch, in BitBucket UI if I navigate to the base branch and list all the branches, even the sub-branches are listed, this will lead to a lot of confusion :( 

Here is a pictorial representation of my issue:

BitBucketIssue.PNG

  1. Banner9 is my repository
  2. StudentSelfService and FacultySeslfService are my base branches under the repository
  3. Acceleration-Student-March-2020 is the new branch that I created INSIDE StudentSelfService branch, but it is showing up in the top hierarchy.

Is there anyway I could make the sub-branch (Acceleration-Student-March-2020) not come up if I list the branches being in the repository? Or is there any better way to have a further 'separation' between objects stored under the same branch?

3 answers

1 vote
Tyler T Atlassian Team Apr 14, 2020

Hello @Shantharam , welcome to the Community!

Git doesn't really have a concept of sub-branches.

You could look at git tags as a way to further organize your work: https://www.atlassian.com/git/tutorials/inspecting-a-repository/git-tag

Right now, all of your branches will show up in that dropdown if they have been pushed up to Bitbucket.

Hi @Shantharam ,

Yes, you can create sub-branches to any branch.

 Lets say you have a master branch then from the master branch you can create a sub-branch.

masterToChild.png

You can further create sub-branches from this child branch.

Here are the steps:

First, go to your repository then choose Branches. On the top right corner, there will be a button with a name Create branch. Click on this button.

subbranch.PNG

 

Now choose your child branch as from branch and enter the name of your new branch.

Finally you will have following hierarchy:

Master

          -> ChildBranch

                 -> GrandChildBranch and so on.

 

You can create any new branch from any existing branch, tag, commit, etc.

Hope it will help.

 

Kindly accept this answer if it resolves your query.

Hi @Shantharam 

Yes, It is possible to create a sub-branch in bitbucket. Even you can create branch to n level.

Let's say you have a master branch in any repository. Now you can create a child branch from  existing master branch.

Here are the steps - 

  • Open your repository
  • Go to Branches
  • Click on Create branch  button on the top right corner of the page

Now you will see the following window:

masterToChild.png

From branch: Choose the branch from which you want to create your new branch

Branch name: Enter the name of your new branch.

and click on the create button.

Now you have 2 branches in your repository.

 

Again repeat the same steps and this time choose your child branch in From branch and enter a new branch name. And you will get a sub-branch.

subbranch.PNG

 

You can create sub-branches to any level. You can also create a branch from any commit, tag, etc.

Hope it will help.

 

Kindly accept this answer if this works for you.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,894 views 0 7
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