git --no-merged 而不是 --contains 的分支标志?

git branch flag for --no-merged and not --contains?

git branch --contains master returns 提示 master 可到达的分支名称。

git branch --merged master returns 可以从 master.

到达顶端的分支的名称

git branch --no-merged master returns 从 master.

无法到达其提示的分支的名称

什么标志(可能在 git 的较新版本中?)显示其尖端既无法从 master 到达,也无法到达 master 的分支的名称他们自己的祖先?换句话说,什么标志给出了 --no-merged --no-contains?

的效果

换句话说,如何显示无法快进合并到master或无法从master快进合并到它们的分支?

2017 年 4 月更新,正如我在“", the option --no-contains is now supported with Git 2.13.

中提到的

原答案

What is the flag (perhaps in a newer version of git?)

首先,您提到的 --(no-)merged 标志已被概括为 ref-filter fairly recently (git 2.7, Sept. 2015)

--no-contains

快速搜索显示此选项不存在(在 git 存储库的任何分支中:

MINGW64 ~/git/git (master)
$ git branch -a | tr -d \*|grep -v origin|xargs git grep --break --heading --line-number 'no\-contain'

因此您需要编写脚本,列出 --contains 未选择的所有分支(但在 --no-merged 中列出)。

"git tag/branch/for-each-ref" family of commands long allowed to filter the refs by:

  • "--contains X" (show only the refs that are descendants of X),
  • "--merged X" (show only the refs that are ancestors of X),
  • "--no-merged X" (show only the refs that are not ancestors of X).

One curious omission, "--no-contains X" (show only the refs that are not descendants of X) has been added to them.