简体   繁体   English

列出除当前分支之外的所有合并分支?

[英]List all merged branches except the current one?

I want to display a list of all branches with Git 2.5.5 that have been merged into the current one except the current one itself (it might also be interesting to list all branches merged into specified branch X except X but my use case at hand only requires this for the current branch).我想显示一个包含 Git 2.5.5 的所有分支的列表,这些分支已经合并到当前分支中,除了当前分支本身(列出合并到指定分支X中的所有分支除了X但我手头的用例可能也很有趣仅对当前分支要求此操作)。

git branch --merged lists all merged branches including the current one, ie it will always list at least one branch. git branch --merged列出所有合并的分支,包括当前分支,即它总是至少列出一个分支。 I can use git branch --merged | sed -ne 's/^ //p;'我可以使用git branch --merged | sed -ne 's/^ //p;' git branch --merged | sed -ne 's/^ //p;' to process the output of git branch --merged to DWIM.处理git branch --merged到 DWIM 的输出。

Is there an existing porcelain command that lists all merged branches except the current one?是否有现有的瓷器命令列出除当前分支之外的所有合并分支? Are there other ways to get this list?还有其他方法可以获取此列表吗?

You can use the command git branch --merged to get the details of the branches merged into the current branch(including the current branch).您可以使用命令git branch --merged获取合并到当前分支(包括当前分支)的分支的详细信息。 You can ignore the current branch (checkedout branch) by using grep or egrep to ignore the current branch (below is the command).您可以通过使用 grep 或 egrep 忽略当前分支(下面是命令)来忽略当前分支(checkedout 分支)。 I have tried this and it displayed all the branches merged into the current branch (excluding the current branch)我试过了,它显示了合并到当前分支的所有分支(不包括当前分支)

git branch --merged | egrep -v "(^\*|<current branch>)"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM