How to become a master git branch

Due to system upgrades, resulting in a new branch is much lower than the remote master branch, and the old master does not need, you need to replace the master branch branch with a new release.

Specific operation is as follows:

1, first back up the old master branch, you can play tag, you can also create a new branch on the basis of the old branch

2, to git the setting page, the default branch temporarily replaced by other branches, such as the release.

3, delete the master branch local and remote (Note: For example, here need to delete the master branch, not local in the master branch, then delete, or will be reported "error: Can not delete branch 'master' checked out at" errors, We need to cut another branch and then delete the master)

  command:

    git branch -D master // delete the local master branch
    git push origin master // delete remote master branch

4, switch to release the branch, then create a local master branch

  git checkout release
  git checkout -b master

5, push the local to the remote master branch
  git push origin master: master

6, the new branch to the default master protection branch and branches, with reference to Step 2

Guess you like

Origin www.cnblogs.com/gramblog/p/11503454.html