I created a branch notmaster
to commit as well as push some changes. When I was finished with that branch, I merged the changes back into master
, pushed them out, and then deleted the local notmaster
.
$ git branch -a * master remotes/origin/master remotes/origin/notmaster
Is there anyway to delete the remote notmaster
?
A little more clarity, with the solution from Ionut:
The usual method failed for me:
$ git push origin :notmaster error: dst refspec notmaster matches more than one.
That's because I had a tag with the same name as the branch. This was a poor choice on my behalf and caused the ambiguity. So in that case:
$ git push origin :refs/heads/notmaster
To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .
In order to clean up remote-tracking branches while fetching, use the “git fetch” command with the “–prune” option. Alternatively, you can simply use the “-p” shortcut instead of typing “prune” every time.
It is safe to delete your local branch after you pushed your changes to your own remote repository. The pull request is unrelated to this, because it is simply a request to the maintainers of the original repository to merge your changes back into their code base.
git push origin :notmaster
, which basically means "push nothing to the notmaster remote".
I had the same issue. I had both a branch and a tag named 3.2. That's why it says there's more than one match:
git error: dst refspec 3.2 matches more than one.
Here's how to delete the branch:
git push origin :heads/3.2
And here's how to delete the tag:
git push origin :tags/3.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With