Make the current Git branch a master branch

前端 未结 14 1910
悲&欢浪女
悲&欢浪女 2020-11-22 05:29

I have a repository in Git. I made a branch, then did some changes both to the master and to the branch.

Then, tens of commits later, I realized the branch is in muc

14条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 05:58

    The following steps are performed in the Git browser powered by Atlassian (Bitbucket server)

    Making {current-branch} as master

    1. Make a branch out of master and name it “master-duplicate”.
    2. Make a branch out of {current-branch} and name it “{current-branch}-copy”.
    3. In repository setting (Bitbucket) change “Default Branch” to point at “master-duplicate” (without this step, you will not be able to delete master - “In the Next step”).
    4. Delete “master” branch - I did this step from source tree (you can do it from the CLI or Git browser)
    5. Rename “{current-branch}” to “master” and push to repository (this will create a new “master” branch still “{current-branch}” will exist).
    6. In repository settings, change “Default Branch” to point at “master”.

提交回复
热议问题