当我在做这个项目的时候(不得不)开始使用Gerrit,所以我使用git push orgin -all
将“所有东西”推送到了Gerrit。不久之前,我注意到我还推送了一些额外的分支,在开始使用Gerrit之前已经合并到了主分支,并且已经在本地删除了:
$ git branch --all
* master
remotes/oberon/master
remotes/origin/96-fix-key-editors-references
remotes/origin/master
我试图按照通常方式(
git push origin :remotes/origin/96-fix-key-editors-references
)删除远程分支,但是Gerrit拒绝了我的请求,声称我没有Push
特权和Force Push
选项,这是完成此任务所必需的。因此,我进入Gerrit的Web UI中的
Project > Branches
,标记了该分支,并通过点击Delete
按钮成功删除了它(有趣的是:我可以在UI中做一些被SSH禁止的事情?)。我以为这个问题已经解决了,直到我再次执行
git branch --all
,发现Git仍然报告分支remotes/origin/96-fix-key-editors-references
仍然存在(结果与上面完全相同)。我又一次使用
git push origin :remotes/origin/96-fix-key-editors-references
,只是出于好奇,想知道现在会发生什么,结果我得到了错误消息,说error: unable to delete '96-fix-key-editors-references': remote ref does not exist
。所以,两个问题,实际上是一个:
Gerrit如何从Web UI中删除分支,而不将其从Git的repo中删除?
如何同时将远程分支列在列表中,又无法删除(因为不存在)?