git Windows 上的分支命名

git branch naming on Windows

当我在 Windows、git bash returns 中执行命令 git checkout -b /dev/myfeature 时出现此错误: fatal: 'C:/Program Files/Git/dev/myfeature' is not a valid branch name.

我做错了什么?

我不是 100% 确定,但我怀疑前导“/” 这类似于这个问题 Which characters are illegal within a branch name?

列表中有尾随“/”...所以我怀疑前导斜杠

来自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.

来自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)

希望对您有所帮助