Home  >  Article  >  Development Tools  >  How to delete master in git

How to delete master in git

WBOY
WBOYOriginal
2022-06-30 17:23:177413browse

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.

How to delete master in git

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

How to delete master in git

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

How to delete master in git

(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

How to delete master in git

(4) Re-operate step 3 to delete the master branch and solve the problem

After deletion:

How to delete master in git

##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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn