Search code examples
gitremote-branch

How to remove remote origin/refs/heads/master


Don't ask me how but I managed to get accidentally the following remote branches in a git repository:

$ git branch -r
  origin/HEAD -> origin/master
  origin/master
  origin/refs/heads/master

All are pointing to the same commit. How can I remove the unnecessary listing for origin/refs/heads/master?

I tried to do the following

$ git push origin :refs/heads/master
error: dst refspec refs/heads/master matches more than one.

But as shown, this gives an error.


Solution

  • The solution was to delete the branch refs/heads/refs/heads/master

    git push origin :refs/heads/refs/heads/master