7

I made a git branch unintentionally named "0.2" which is also a tag.

So I tried to remove it from origin:

$ git branch -rD origin/0.2
Deleted remote branch origin/0.2

But then:

$ git fetch origin
 * [new branch]      0.2        -> origin/0.2

Here is the error I got wwhen pushing:

$ git push --force origin :0.2
error: dst refspec 0.2 matches more than one.

So I removed the remote tag:

$ git tag -d 0.2
$ git push origin :refs/tags/0.2

Still no go:

$ git branch -rD origin/0.2
 * [new branch]      0.2        -> origin/0.2
  1. Is it a git bug?
  2. Did I do something wrong apart from having a tag and branch name equals?
  3. How to remove this remote branch?
3
  • 4
    Have you tried git push origin :0.2? Commented Apr 25, 2012 at 20:01
  • 1
    does the remote tag still exist? also try git remote prune origin Commented Apr 25, 2012 at 20:08
  • git branch -rD origin/0.2 is the same as git push origin :0.2 for newest git version. And yes the remote tag was still there. I also tried the prune. Commented Apr 25, 2012 at 20:29

2 Answers 2

3

This worked for me:

$ git push --delete origin refs/heads/0.2
Sign up to request clarification or add additional context in comments.

Comments

2

Normally running git push --force origin :0.2 after having deleted (locally and remotely) the tag should do the correct deletion.

1 Comment

Indeed, doing my two commands together solved the issue. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.