意外地,创建了一个分支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 '[email protected]:...'

.git/config有标准节
[remote "upstream"]
    url = [email protected]:...
    fetch = +refs/heads/*:refs/remotes/upstream/*

最佳答案

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

$ git branch -r -D upstream/upstream/develop
Deleted remote-tracking branch upstream/upstream/develop (was e49bbca1).

关于git - 从github删除错误的分支remotes/upstream/upstream/develop],我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52445167/

10-13 09:21