I foolishly named a branch starting with a hyphen, and then checked the master. I did not want to delete my branch, I worked in it.
None of them worked:
git checkout -dumb-name
git checkout -- -dumb-name
" s, ' and \ didn't help either.
This worked: go into your working copy of .git / refs / heads, find the file name -dumb-name (or something else) and get the hash of the branch. Then:
git checkout {hash} git checkout -b brilliant-name git branch -d -- -dumb-name
source share