First of all, a wild hunch: are these branches actually located in the GitHub repository visible on the Internet, or do you just see them as remote branches in your repo? (Run git remote update --prune
to update anything that will cut them if they are only in your local repo.)
Use git ls-remote origin
to print links on the remote control, since the remote sees them, for example:
406da7803217998ff6bf5dc69c55b1613556c2f4 HEAD 1e501a7c47ad5ada53d3b1acfb9f131f76e969ec refs/heads/maint 406da7803217998ff6bf5dc69c55b1613556c2f4 refs/heads/master 56e79320f3d9b044c380dfebf136584aaa17ac5b refs/heads/next ...
Find the ones you want to remove, then use git push :<ref>
to delete, for example. git push :refs/heads/branch-foo
.
I'm not quite sure what is happening for you, but assuming that refs do exist on the remote control, this should be a reliable way to see and delete them. My best guess is that the links you see on GitHub are not actually in the refs/heads
, so using an unqualified name does not work. (I'm not sure how you would find yourself in this situation!
source share