How to delete remote branches pushed locally in git

 

After using git to manage code in a project, many branches with different names are often created to distinguish the code functions of each branch.

 

As the code is merged, the previous branch may no longer need to be saved. In order to clearly find the current important branches, it is necessary to delete the useless branches.

 

Then you can use the following command:

 

git push origin --delete <branchName>

 

To delete tags use this:

 

git push origin --delete tag <tagname>

 

According to the Internet, there is another form.

 

git push origin :<branchName>

git tag -d <tagname>
git push origin :refs/tags/<tagname>

 

I used the first method just fine, so I didn't use the second method.

ps: When using the second method, pay attention to the use of colons.

Guess you like

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