Why can't I delete a remote git branch with gi

2020-08-09 09:50发布

问题:

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?

回答1:

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.



标签: git