I accidentally created a branch called “remotes/origin/remotes/origin/aclark” and can’t delete it with:
git branch -d remotes/origin/remotes/origin/aclark
Git says:
error: branch ‘remotes/origin/remotes/origin/aclark’ not found.
I tried some of the suggestions here: Deleting a badly named git branch, but they are geared more towards bad branch names that start with “–“.
Is there any way an end user can delete this branch or do I need a git admin? (The branch in question lives at gitorious).
Thanks
Alex
This is a remote branch, so you need to delete it on the server. To do that, you need to push an empty reference.
Note, the syntax of the
git pushcommand is:So in the case, we are pushing an empty reference, and the remote name is the name of the branch we want to destroy. In your case, the branch name “remotes/origin/remotes/origin/aclark” indicates that it is a remote branch on the remote server name “origin”, and the name on the distant server is “remotes/origin/aclark”.
The other client will need to issue the following commands to have the branch removed from their local repository (if they fetched when the invalid branch existed):
More information can be found in the git-push and git-remote manpages.