如何删除Git中的远程分支? [英] How do I delete a remote branch in Git?
问题描述
我创建了一个分支 notmaster
来提交以及推送一些更改。当我完成该分支时,我将这些更改合并到 master
中,并将它们推出,然后删除本地 notmaster $ c $
$ git branch -a
* master
遥控器/ origin / master
remotes / origin / notmaster
是否有删除远程 notmaster
?
更清晰一点,用来自Ionut的解决方案:
通常的方法失败了:
$ git push origin:notmaster
错误:dst refspec notmaster不止一个匹配。
这是因为我有一个与分支名称相同的标签。这对我来说是一个糟糕的选择,造成了模糊性。所以在这种情况下:
pre $ $ git push origin:refs / heads / notmaster
I created a branch notmaster
to commit as well as push some changes. When I was finished with that branch, I merged the changes back into master
, pushed them out, and then deleted the local notmaster
.
$ git branch -a
* master
remotes/origin/master
remotes/origin/notmaster
Is there anyway to delete the remote notmaster
?
A little more clarity, with the solution from Ionut:
The usual method failed for me:
$ git push origin :notmaster
error: dst refspec notmaster matches more than one.
That's because I had a tag with the same name as the branch. This was a poor choice on my behalf and caused the ambiguity. So in that case:
$ git push origin :refs/heads/notmaster
git push origin :notmaster
, which basically means "push nothing to the notmaster remote".
这篇关于如何删除Git中的远程分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!