Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating branch inside a branch

Shantharam April 14, 2020

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 accepted

1 vote
Answer accepted
Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 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.

1 vote
Nitish
Contributor
April 15, 2020

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.

0 votes
Nitish
Contributor
April 15, 2020

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.

Suggest an answer

Log in or Sign up to answer
TAGS
loom essentials certification, loom training, get certified in loom, atlassian certification, loom async video, video messaging skills, atlassian learning, loom for teams, online certification, loom badge, loom for business, atlassian education

Get Certified in Loom! 🧑‍🎓

Time to up your Loom game! The new Loom Essentials Certification is here! Show off your skills, learn pro tips, and get officially recognized. Perfect for taking your video messaging to the next level.

Learn more
AUG Leaders

Atlassian Community Events