[英]Git: unrecognised branch name
In git, I named a branch: parse() 在git中,我命名了一个分支:parse()
The name has been accepted, but when merging I get the error: 该名称已被接受,但合并时我收到错误:
git merge parse() bash: syntax error near unexpected token '(' git merge parse()bash:意外令牌附近的语法错误'('
Is it possible to rename a branch? 是否可以重命名分支? Are there other ways to fix this problem? 还有其他方法可以解决这个问题吗?
Thank you! 谢谢!
Platform: Linux, bash 平台:Linux,bash
Try merging by putting quotes around the branch name instead, eg: 尝试通过在分支名称周围加上引号进行合并,例如:
git merge 'parse()'
You can rename a branch, but it's not so straightforward. 您可以重命名分支,但这并不是那么简单。 Wherever you want to use the branch name, just use quotes (single or double!). 无论您想使用分支名称,只需使用引号(单引号或双引号!)。
You can rename a branch using : 您可以使用以下命令重命名分支:
git branch -m 'parse()' your_new_branch_name
(see Switch branch names in git ) (请参阅git中的切换分支名称 )
You should also note that using parenthesis in branch names (or any special bash character) will only cause you problems. 您还应注意,在分支名称(或任何特殊的bash字符)中使用括号只会导致问题。 I would recommend using only [-_a-zA-Z0-9]
characters. 我建议只使用[-_a-zA-Z0-9]
字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.