从git [hub]删除错误的分支远程/上游/上游/开发

时间:2018-09-21 13:47:42

标签: git github branch

偶然地,已经创建了分支remotes/upstream/upstream/develop。上游受GitHub控制。标准删除命令失败:

$ git fetch --all
$ git branch -a
* develop
  master
  remotes/origin/HEAD -> origin/develop
  remotes/origin/develop
  remotes/origin/master
  remotes/upstream/develop
  remotes/upstream/master
  remotes/upstream/upstream/develop
$ git push upstream --delete upstream/develop
error: unable to delete 'upstream/develop': remote ref does not exist
error: failed to push some refs to 'git@github.com:...'

.git/config具有标准节

[remote "upstream"]
    url = git@github.com:...
    fetch = +refs/heads/*:refs/remotes/upstream/*

1 个答案:

答案 0 :(得分:0)

显然,意外创建的分支从未被推送到上游服务器,或者未被接受;无论如何,git branch fetch --all并未将其传播到其他客户端。因此可以使用

在本地删除
$ git branch -r -D upstream/upstream/develop
Deleted remote-tracking branch upstream/upstream/develop (was e49bbca1).