How to change the main branch in BitBucket?

那年仲夏 提交于 2021-02-06 14:47:20

问题


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.


回答1:


  1. Repositories

  1. Select repository
  2. Settings

  1. Main branch: master

  1. Save repository details




回答2:


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




回答3:


You can merge the trunk into master (you may have to force it) and then delete the trunk

git checkout master
git merge trunk


来源:https://stackoverflow.com/questions/37550492/how-to-change-the-main-branch-in-bitbucket

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!