列出除当前分支以外的所有合并分支? [英] List all merged branches except the current one?
问题描述
我想显示所有Git 2.5.5分支的列表,这些分支已合并到当前分支中,但当前分支本身除外(列出所有合并到指定分支X
中的分支,除了
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 branch --merged
列出了所有合并的分支,包括当前分支,即i. e.它总是会列出至少一个分支.我可以使用git branch --merged | sed -ne 's/^ //p;'
处理git branch --merged
到DWIM的输出.
git branch --merged
lists all merged branches including the current one, i. e. it will always list at least one branch. I can use git branch --merged | sed -ne 's/^ //p;'
to process the output of git branch --merged
to DWIM.
是否存在现有的瓷器命令,其中列出了除当前分支以外的所有合并分支?还有其他方法可以获取此列表吗?
Is there an existing porcelain command that lists all merged branches except the current one? Are there other ways to get this list?
推荐答案
您可以使用命令git branch --merged
获取合并到当前分支(包括当前分支)中的分支的详细信息.您可以通过使用grep或egrep忽略当前分支(以下为命令)来忽略当前分支(checkedout分支).我已经尝试过了,它显示了合并到当前分支中的所有分支(不包括当前分支)
You can use the command git branch --merged
to get the details of the branches merged into the current branch(including the current branch). You can ignore the current branch (checkedout branch) by using grep or egrep to ignore the current branch (below is the command). 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>)"
这篇关于列出除当前分支以外的所有合并分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!