How to change the main branch in bitbucket?

Member

by shyann , in category: Javascript , 3 months ago

How to change the main branch in bitbucket?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by denis , 3 months ago

@shyann 

To change the main branch in Bitbucket, you will need to follow these steps:

  1. Log in to your Bitbucket account and select the repository you want to change the main branch for.
  2. Click on the "Settings" tab in the repository menu.
  3. In the repository settings, go to the "Branching model" section.
  4. Look for an option called "Main branch" or "Default branch" and click on the edit button next to it.
  5. Select the branch you want to set as the main branch from the drop-down menu.
  6. Save your changes.
  7. You may also need to update your local repository to reflect the new main branch by running the following command in your terminal:
1
2
3
4
git branch -m old_branch new_branch
git fetch origin
git branch -u origin/new_branch new_branch
git push -u origin new_branch


After completing these steps, the main branch in your Bitbucket repository should be successfully changed.