So, I was deleting a local branch with the command git branch -D and after deleting the branch, a new branch, named '-D' showed up in my local repo. So now when I run 'git branch' there is a branch called '-D'.
Unfortunately, when I try to delete this branch, using 'git branch -D -D', I get a 'fatal: branch name required' error.
Any ideas how to get rid of this branch?
You can try:
git branch -D -- -D
Where -- is a fairly common syntax for "stop interpreting - as introducing an option after this point". This seems to work in my test:
$ git branch
-D
foo
* master
$ git branch -D -- -D
Deleted branch -D (was 460317a).
If that doesn't work, you could try to delete .git/refs/heads/-D if it exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With