git delete remote branch not working: branch not found
According to this post:
Deleting is also a pretty simple task (despite it feeling a bit kludgy):
git push origin :newfeature
That will delete the newfeature branch on the origin remote, but you’ll still need to delete the branch locally with git branch -d newfeature.
So the error you got just means you don't have a local copy of that branch, so you can ignore it. Then to delete the remote copy:
git push origin :branch_to_delete
If you couldn't see it on the server (which is my case, because someone has already deleted that branch on the remote server) but it's still present in your local .git
repository as the remote branch, you would be able to fix the issue with nor git push origin --delete [branch]
neither with git push origin :branch_to_delete
. Instead run the
git branch --all
git remote prune origin
git branch --all
replacing the origin
with the name of your remote.
To delete a remote branch, the command is:
$ git push origin --delete [branch]
It looks like someone forgot the '--delete' in one of the earlier answers.