如果给出了--list
,或者没有非选项参数,则列出现有分支;否则,将列出现有分支.当前分支将以星号突出显示.选项-r
导致列出远程跟踪分支,选项-a
同时显示本地和远程分支. 如果给出了<pattern>
,则用作外壳通配符,以将输出限制为匹配的分支.如果给出了多个模式,则显示与任何模式匹配的分支.请注意,在提供<pattern>
时,必须使用--list
.否则,该命令将被解释为分支创建.
If --list
is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an asterisk. Option -r
causes the remote-tracking branches to be listed, and option -a
shows both local and remote branches. If a <pattern>
is given, it is used as a shell wildcard to restrict the output to matching branches. If multiple patterns are given, a branch is shown if it matches any of the patterns. Note that when providing a <pattern>
, you must use --list
; otherwise the command is interpreted as branch creation.
因此,至少根据文档,答案是它用作外壳通配符".当然,这是假定您知道短语"shell通配符"的含义-更重要的是,这是错误,因为在/
上,直壳通配符将不匹配.
So the answer, at least according to the documentation, is that "it is used as a shell wildcard". This assumes, of course, that you know what the phrase "shell wildcard" means—and more importantly, it's wrong, since a straight shell wildcard would not match across the /
.
文档应该说:该模式的行为与shell通配符/glob模式非常相似,不同之处在于,不对斜杠进行特殊处理,因此a*b
与accb
和ac/cb
以及a[bc/]*
都匹配.匹配所有a/d
,abcd
,ac/cb
和accb
."
The documentation should say something like: "The pattern acts much like a shell wildcard / glob pattern, except that slashes are not treated specially, so that a*b
matches both accb
and ac/cb
, and a[bc/]*
matches all of a/d
, abcd
, ac/cb
, and accb
."
示例:
$ git branch -a
a/d
abcd
ac/cb
accb
* master
$ git branch --list 'a*b'
ac/cb
accb
$ git branch --list 'a[bc/]*'
a/d
abcd
ac/cb
accb
$
这篇关于< pattern>的格式是什么?在git-branch --list的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!