Reputation: 3153
I have a repo on bitbucket with two branches. First branch is master with a fake content, then I have another one called trunk with the correct content.
I would like to change the main branch to trunk (actually is master). I found that in the repo adminsitration are on bitbucket web I could change this but I couldn't.
Finally I would like to understand if is possible to do this through terminal from my local repo.
Maybe an easy thing is to delete contents from master and merge trunk into master and the delete trunk but I neither know how to do this.
Upvotes: 51
Views: 54934
Reputation: 11689
Back in the day
master
Upvotes: 86
Reputation: 346
Relevant for folks who are looking at this question in 2022
The menu options have changed a bit. The following steps can help you achieve the same.
advanced
written on it ( refer to image ).I hope it helps :)
Upvotes: 11
Reputation: 2134
With two branches named trunk
and master
, change master to the HEAD of the repository and delete trunk
:
git symbolic-ref HEAD refs/heads/master
git branch -d trunk
From:
https://answers.atlassian.com/questions/280944/how-to-change-main-branch-in-bitbucket
Upvotes: 1
Reputation: 589
You can merge the trunk into master (you may have to force it) and then delete the trunk
git checkout master
git merge trunk
Upvotes: 0