delete erroneous branch remotes/upstream/upstream/develop from git[hub]

Viewed 60

By accident, a branch remotes/upstream/upstream/develop has been created. Upstream is under GitHub control. The standard delete command fails:

$ 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 has the standard stanza

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

Apparently, the accidentally created branch was never pushed to the upstream server, or not accepted; anyway, git branch fetch --all did not propagate it to other clients. So it could be deleted locally with

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