I created a git branch name -new-br
:
git checkout -b -new-br.
I switched back to parent branch.
Now I am unable to checkout -new-br
.
git checkout -new-br.
getting error:
error: unknown switch `n'
usage: git checkout [options] <branch>
or: git checkout [options] [<branch>] -- <file>...
How can I check this branch out?
Many Unix commands accept --
to mean "no more switches" and further arguments aren't then parsed as switches. See "What does “--” (double-dash) mean?" on this adjacent site.
So...
git checkout -- -new-br
...would probably suffice.
However... which version of Git are you using to create such a branch? Git version 1.8.4 tells me:
git checkout -b -new-br
fatal: '-new-br' is not a valid branch name.
Trying it another way...
git branch -- -new-br
fatal: '-new-br' is not a valid branch name
I suggest that you check the names of all your branches with:
git branch --list --all
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