git command to delete project branch remotely

If a project has multiple branches and you only want to keep one branch, you can consider deleting a branch remotely with the git command.

For example, there are now two branches, one is master and the other is lunbo. As shown in Figure 1 below:


figure 1

Now want to delete the master branch; do the following:

git branch -r (view the list of remote branches) as shown in Figure 2:
 git branch -r -d origin/master (delete the local remote branch) as shown in Figure 3
git push -u origin master ( delete the branch on the git server remotely ) as shown in the figure 4

 The problem in Figure 4 is because the master is the default branch, as long as you change the default on github, as shown in Figure 5 (this is after modification):


figure 2


image 3 


Figure 4


Figure 5


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324891069&siteId=291194637
Recommended