Home > Article > Development Tools > How to delete master in git
Method: 1. Enter the git project homepage and select "Edit Project" in the settings in the upper right corner; 2. Find "Default Branch" and select temp as the default branch; 3. Find "Visibility Level" and make it private Modify it to public; 4. Use the "git branch -d master" and "git push origin :master" commands to delete the master branch.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
When we delete the master branch, there will always be prompts such as failure, the branch has been protected, etc. Today I will tell you how to delete master. branch.
1, first create a temporary branch
//创建分支 git branch temp //推送分支到远程仓库 git push origin temp:temp
2, switch branches
//切换分支到临时分支 git checkout temp
3, delete the master branch
//删除本地master分支 git branch -d master //删除远程分支 git push origin :master
I saw that the deletion failed and the branch was To protect it, you need to do this operation.
The steps are as follows:
(1) Enter the git project homepage---select the settings in the upper right corner---Edit Project
(2) Find the Default Branch---select temp as the default branch
(3) Find the Visibility Level and change the original setting to private to public
(4) Re-operate step 3 to delete the master branch and solve the problem
After deletion:
##Recommended study: "Git Tutorial》
The above is the detailed content of How to delete master in git. For more information, please follow other related articles on the PHP Chinese website!