无效的git分支名称 [英] Not a valid git branch name
问题描述
我正在尝试在我的仓库的功能标签下创建一个新分支,我正在使用以下方法来做到这一点:
I am trying to create a new branch under feature tag of my repo, I am using following to do this:
git branch "feature/BA-302-[AU]Intl-BCard"
但是我得到了:
致命:'feature/BA-302- [AU] Intl-BCard'不是有效的分支名称.
fatal: 'feature/BA-302-[AU]Intl-BCard' is not a valid branch name.
不确定,我想念的是什么
Not sure, what I am missing
还要澄清一下,我已经尝试过:
Also to clarify, I have already tried to:
git checkout -b feature/BA-302-[AU]Intl-BCard
具有以下结果:
zsh:找不到匹配项:feature/BA-302- [AU] Intl-BCard
zsh: no matches found: feature/BA-302-[AU]Intl-BCard
推荐答案
[
".有关更多详细信息,请参见 man git-check-ref-format
或此处.<
[
is not allowed in a branch name. See man git-check-ref-format
or here for more details.
在 zsh
中, [...]
定义了shell尝试匹配的字符类.如果没有匹配项,则会出现错误 zsh:找不到匹配项
.使用引号会阻止匹配.在bash中,可以通过运行 shopt -s failglob
来打开类似的行为.
In zsh
, [...]
defines a character class the shell tries to match. If there's no match, you get the error zsh: no matches found
. Using quotes prevents the matching. In bash, similar behaviour can be turned on by running shopt -s failglob
.
这篇关于无效的git分支名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!