结帐到包含'&'的分行在它的名字

时间:2017-02-24 12:37:42

标签: git git-checkout

我有一个名为 yard& park 的分支。当我尝试使用此命令时

git checkout yard&park

它显示我跟随错误

[1] 22471
error: pathspec 'yard' did not match any file(s) known to git.
No command 'park' found, did you mean:
 Command 'parl' from package 'libpar-packer-perl' (universe)
 Command 'pack' from package 'liballegro4-dev' (universe)
 Command 'pmark' from package 'libxgks-dev' (universe)
 Command 'ark' from package 'ark' (universe)
 Command 'pork' from package 'pork' (universe)
 Command 'par2' from package 'par2' (universe)
 Command 'spark' from package 'spark' (universe)
 Command 'mark' from package 'mailutils-mh' (universe)
 Command 'mark' from package 'nmh' (universe)
 Command 'par' from package 'par' (universe)
park: command not found
[1]+  Exit 1                  git co yard

我该如何结账到这个分行。

3 个答案:

答案 0 :(得分:2)

用引号包装名称

git checkout "yard&park"

这将允许您查看它。

enter image description here

答案 1 :(得分:2)

shell正在解释&字符。您可以通过用引号包围它来阻止shell执行此操作:

$ git checkout 'yard&park'

答案 2 :(得分:2)

在引号中指定名称

git checkout "yard&park"