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

How to change MAIN branch in BitBucket?

rakesh-eminence January 9, 2019

I have 

5 answers

20 votes
Brian Wagner September 10, 2021

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"

Nero Zen October 9, 2021

Thanks

Like dbadia likes this
dbadia November 22, 2021

This is the correct answer

Like Dean Cox likes this
Moctezuma
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!
December 15, 2023

Thanks.

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.
January 9, 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

David Boyd April 20, 2021

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
Hai Tran Hoang July 29, 2021

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
Mike Hagesfeld January 7, 2022

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

Like Ken S_ likes this
John Bronson December 7, 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.

0 votes
Nasir Maqbool June 25, 2022

let me know answer?

0 votes
mr.wajahatanwar@gmail.com December 23, 2021

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

Ken S_ October 19, 2022

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??

Stijn November 18, 2022

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 # people like this
Ken S_ December 16, 2022

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!

Stijn December 18, 2022

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

0 votes
Josh Beauregard September 28, 2021

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

davidajacobus November 6, 2021

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. 

Josh Beauregard November 19, 2021

I want this for my workspace not per repo

Like # people like this
jake-aft September 20, 2023

100% agree

If you create a Jira SW Project and select to create a repo, it creates the master and not main. Pretty average UX and integration between the tools.

Moby QT February 6, 2024

@davidajacobus @Josh Beauregard @jake-aft 

The bug looks like it was fixed. As mentioned above, it is described in https://jira.atlassian.com/browse/BCLOUD-22261, but the status is out of date... nobody had said it was fixed, but I just confirmed and left an note in the bug.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events