Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I delete a remote git branch with git push origin :branchname?

Tags:

git

When I try to push to a remote git branch to delete it with git push origin :branchname I get the following error message:

error: unable to push to unqualified destination: remotes/origin/branchname The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref.

But when I type git branch -a I still see it in remotes/origin/branchname. Why can't I delete it remotely?

like image 965
ryantm Avatar asked Jul 21 '11 23:07

ryantm


1 Answers

The branch has already been deleted in the origin repository. You can reflect this in your local remotes when you fetch by doing git fetch --all --prune, which will delete it from your remotes. You can also more specifically do git remote prune to just prune your remotes without updating.

like image 178
ryantm Avatar answered Oct 04 '22 20:10

ryantm