0

When I execute the command git checkout -b /dev/myfeature in Windows, git bash returns with this error: fatal: 'C:/Program Files/Git/dev/myfeature' is not a valid branch name.

What am I doing wrong?

Robert Sim
  • 1,428
  • 11
  • 22

2 Answers2

5

From https://git-scm.com/docs/git-branch

The name of the branch to create or delete. The new branch name must pass all checks defined by git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name.

And from https://git-scm.com/docs/git-check-ref-format:

They cannot begin or end with a slash / or contain multiple consecutive slashes (see the --normalize option below for an exception to this rule)

Hope this helps

Witnessthis
  • 136
  • 4
3

I'm not 100% sure here, but I suspect the leading "/" This is similar to this question Which characters are illegal within a branch name?

Which has a trailing "/" in the list... so I'm suspicious of the leading slash

kah608
  • 545
  • 2
  • 10