[英]git branch flag for --no-merged and not --contains?
git branch --contains master
returns the names of branches from whose tips master
is reachable. git branch --contains master
返回其提示master
可达的分支的名称。
git branch --merged master
returns the names of branches whose tips are reachable from master
. git branch --merged master
返回其提示可从master
访问的分支的名称。
git branch --no-merged master
returns the names of branches whose tips aren't reachable from master
. git branch --no-merged master
返回其提示无法从master
访问的分支的名称。
What is the flag (perhaps in a newer version of git
?) to show the names of branches whose tips are neither reachable from master
, nor can reach master
in their own ancestry?什么是标志(也许在新版本的
git
?),以显示其分支提示从没有到达的名字master
,也可以达到master
在自己的祖先? In other words, what flag gives the effect of --no-merged --no-contains
?换句话说,什么标志给出了
--no-merged --no-contains
?
To put it another way, how to show branches which could not have a fast forward merge into master nor have a fast forward merge from master into them?换句话说,如何显示既不能快进合并到 master 也不能从 master 快进合并到它们的分支?
Update April 2017 , as I mentioned in " How to list all git branches containing a commit ", the option --no-contains
is now supported with Git 2.13 . 2017 年 4 月更新,正如我在“如何列出包含提交的所有 git 分支”中提到的, 现在 Git 2.13 支持选项
--no-contains
。
Original Answer原答案
What is the flag (perhaps in a newer version of git?)
标志是什么(也许在较新版本的 git 中?)
First, the --(no-)merged
flags you mention have been generalized as ref-filter fairly recently (git 2.7, Sept. 2015) .首先,您提到的
--(no-)merged
标志最近被概括为 ref-filter (git 2.7, Sept. 2015) 。
--no-contains
A quick search reveals this option does not exist (in any of the branches of the git repo:快速搜索显示此选项不存在(在 git repo 的任何分支中:
MINGW64 ~/git/git (master)
$ git branch -a | tr -d \*|grep -v origin|xargs git grep --break --heading --line-number 'no\-contain'
So you would need to script that, listing all branches which are not selected by --contains
(but are listed in --no-merged
).因此,您需要编写脚本,列出所有未由
--contains
选择的--contains
(但在--no-merged
中列出)。
"
git tag/branch/for-each-ref
" family of commands long allowed to filter the refs by:“
git tag/branch/for-each-ref
”系列命令长期以来允许通过以下方式过滤参考:
- "
--contains X
" (show only the refs that are descendants ofX
),“
--contains X
”(仅显示作为X
后代的引用),- "
--merged X
" (show only the refs that are ancestors ofX
),“
--merged X
”(仅显示作为X
祖先的引用),- "
--no-merged X
" (show only the refs that are not ancestors ofX
).“
--no-merged X
”(仅显示不是X
祖先的引用)。One curious omission, "
--no-contains X
" (show only the refs that are not descendants ofX
) has been added to them.一个奇怪的遗漏,“--
--no-contains X
”(只显示不是X
后代的引用)已添加到它们中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.