Aliens

Git常用操作

May 21, 2021

1.如何删除远程仓库上的分支/tag

https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-locally-and-remotely https://stackoverflow.com/questions/5480258/how-to-delete-a-remote-tag

删除远程仓库上的分支

1
2
$ git push -d <remote_name> <branch_name>
$ git branch -d <branch_name>

Note that in most cases the remote name is origin. In such a case you’ll have to use the command like so.

1
$ git push -d origin <branch_name>

删除远程仓库的tag同理

1
git push --d origin tagname

如果还需要删除本地的tag,那么

1
git tag -d tagname