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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,798
Community Members
 
Community Events
184
Community Groups

How to change MAIN branch in BitBucket?

I have 

5 answers

18 votes
Rafael Pinto Sperafico
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jan 09, 2019

Hi @rakesh-eminence,

In Bitbucket Cloud, please go to [Your Repository] >> Settings >> General >> Repository details >> Update repository details >> Main branch.

At the same time, I would suggest you on having a look at Branching a Repository, focusing on The Branching model which describes the DEVELOPMENT label and PRODUCTION (disabled by default).

Screenshot 2019-01-10 at 9.41.00.pngMore information is also available on Weird square appeard on Branch site.

Hope the above answer to your inquire.

Kind regards,

Rafael

Hello @Rafael Pinto Sperafico 

 

After following the above - I am still seeing in the branches view that master is identified as MAIN.  I can only view develop branch when I change the selection criteria to all branches.

Like Lucas Rencker likes this

It doesn't work for me.

The branch can only be chose from dropdown list.

But it always limit 25 results and not searching exactly the text I type in, just list out any branch name including that text.

So I could not find the correct branch to set it as main branch.

Like # people like this

There is still no way to change the default initial main branch name?

Like Ken S_ likes this
John Bronson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Dec 07, 2022

Hai's answer was the answer I ended up here looking for. That pull down isn't clear about the fact that it's limited to a fixed number of branches.

In my experience, I was able to change this setting from the General > Repository Details sidebar menu tab. In the main content area, there is an Advanced section that is closed by default. Open it and there are other settings, including one for "Main branch"

Like dbadia likes this

This is the correct answer

Like Dean Cox likes this

let me know answer?

Here are the steps to change the "Main" branch

  1. Go to Repository Details
  2. Click on Advanced to explore more options
  3. Select the main branch from the "Main Branch" dropdown

Now your main branch is changed.

 

Thanks

Can someone please provide some screenshots (from 2022)? I am lost in an endless web of sidebars, ever-shifting avatars (top left, bottom right), Cloud, Personal Settings, Account Settings, and other endless menus that is the Atlassian eco-mess.  Where exactly do you find any of these menu items in Bitbucket??

Hi Ken,

TL;DR the suggested solution only works if you already have a "main" branch in your repo. It also needs to be performed per repo.
The default name is still "master". A new ticket was made for this that you can find here: https://jira.atlassian.com/browse/BCLOUD-22261

 

Made a quick test repo. The location mentioned is located under the repository settings (last item, on the left hand side bar at time of writing this).
Clicking it you automatically end up at the "repository details" page.

On that page you scroll down, and open the "Advanced" section. In that section there is a drop down where you can select what your "main branch" should be. But it only lists the available branches on your repo.

If you create an empty repo, and don't specify the default branch name it still only lists "Master" as an option.

defaultStillMaster.png

Kind regards,

Stijn

Like Ken S_ likes this

Thank you. Any movement on fixing this? As you rightfully pointed out, Atlassian is contradicting themselves preaching to move away from the "master" terminology, but then providing no easy/automatic setting to do so!

Hi Ken,

I don't work for Atlassian so I can't provide an update on this ticket.

One way to work around it is to create a new branch from "master" called "main". Then go into the repo settings and change the "Main branch" setting to "main". From there you could delete to "master" branch.

If you normally work in branches and merged towards "master" by creating a pull requests from the web client, then Bitbucket should now suggest "main" as destination instead of "master" independent of where you branched of from (it seems to suggest whatever branch is labeled "main" as the destination of PRs ).

Obviously if you work with a "stable trunk" style way of working and directly push changes on "master" then you need to align the change to "main" with other users.

Also, this has to be done per repository. As far as I know there is no way to change this in all repositories in a workspace at the same time.

Hope this helps,

Stijn

is there a way to change the default setting from master to main?

I have not seen it built into BitBucket, however what you can do is create a new "main" or "mainline" branch from master, set that as the root and then delete master. 

I want this for my workspace not per repo

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events