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

How to change MAIN branch in BitBucket?

Mikhail_Kopylov
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.
April 5, 2014

Have a main branch in BitBucket named "trunk" (after import from SVN).

Also have branch named "master" - branched from "trunk".

How to set "master" the main branch in BitBucket and then delete "trunk" branch?

3 answers

1 accepted

9 votes
Answer accepted
Robust April 5, 2014
git symbolic-ref HEAD refs/head/master
git branch -d trunk

Puckey April 21, 2016
refs/heads/master

NOT

refs/head/master

??

Like # people like this
Ramratan Gupta February 11, 2019

Is solution working for new branch to be set up as default branch? I need to set new default branch other than master, I need to each time do the same thing as first aswer, need to write and automation script which do the same for 4 repositories.

Ref - https://stackoverflow.com/a/37550604/1589444

74 votes
Deleted user April 6, 2014

In Bitbucket UI:

  1. Select the repository
  2. Select Administration
  3. In Repository Details, set Main branch

Now delete unnecessary branches with git branch -d.

liahsheep September 23, 2015

In the updated Bitbucket UI, select *Settings* instead of *Administration* in Step 2.

Like # people like this
Deleted user November 3, 2016

Check permissions if you don't see the "Settings" link.

Like EugeneArtemenko_EA likes this
sandeepshetty1 June 13, 2018

Thanks, worked

Like Сергей Русак likes this
Carlos Augusto November 19, 2018

Thanks, worked

Dave Sky November 19, 2018

Why did I get an email for Carlos' "Thank" reply? I merely replied to Christian's reply on a separate sub-thread.

I notice this thread is marked "Watched" for me... I don't want to auto-watch a thread just because I reply to someone in it.

Gonçalo Silva Dias May 12, 2019

what is the difference between "main" and "development" branch?

Like Robert Grady likes this
Dave Sky May 16, 2019

I'm not watching this thread yet I'm getting emails for random replies here but not to my replies... not seeing how to unsubscribe from this.

Engr Munib May 11, 2020

Thank you. It was helping

0 votes
Christian Bacher September 26, 2015

After changing the main branch - when cicking on "save reporistory details" i get a wired error:

"You can't create repositories under this account."

 

Dave Sky July 17, 2018

Seems like you need admin access.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events