先查看遠程分支
git branch -r
使用下面兩條命令來刪除遠程分支
git branch -r -d origin/branch-name
git push origin :branch-name
update:
解釋一下上面的參數含義:
-r, --remotes
List or delete (if used with -d) the remote-tracking branches.
上面的第一句是刪除了本地的遠程跟蹤分支( 我也不知道怎么描述更加清楚),此時使用git branch -a查看,分支remotes/origin/branch-name應該已經不存在了。
為什么還需要第二句,因為上面只是把本地的遠程跟蹤分支刪除了,遠程的分支還沒有刪除,所以第二句就是真正的刪除原種分支。
若出現錯誤 重新操作
Pushing an empty <src> allows you to delete the <dst> ref from the remote repository.
