Home > Mobile >  git local branch named -D is created, how to delete it
git local branch named -D is created, how to delete it

Time:07-28

When I tried to remove branch with the command : git branch –D origin/image

I this message:

Branch '–D' set up to track remote branch 'image' from 'origin'.

and now a branch named "-D" is created locally buy does not exist globally. How can I remove it as it is a flag of git command and so not letting me delete with this command : git branch -D -D.

*using bitbucket and vscode.

CodePudding user response:

You can use the -- option to say the rest of the command line is not options, like most Linux (or Linux originating) commands allow:

git branch -d -- -D

But check if it's really a hyphen, or if it's a unicode dash instead. You used both in the question interchangeably, which is why I ask.

CodePudding user response:

You have to can use a low-level command:

git update-ref -d refs/heads/-D
  • Related