Can't checkout git branch started with hyphen (-)

git

Solution

Finally I am able to get things working based on VonC's Answer.

Solution 1:

`git checkout -b feature-abc origin/-feature-abc`

Solution 2:

- Go into your working copy's `.git/refs/remotes/origin`,

- find the file named "`-feature-abc`",

- get the hash of the branch (`cat` the file),

- Then check it out, make a new branch with a sane name,

- Make new branch track remote branch.

git checkout {hash}
git checkout -b feature-abc
git branch --set-upstream-to=origin/-feature-abc feature-abc

Make an existing Git branch track a remote branch?

Problem

I have cloned a git repository. This repository has a remote branch something like `-feature-abc`. When I type `git checkout -feature-abc`, I get: ``` error: unknown switch `e' ``` Any idea how to checkout this branch?

Original source

Related problems