[英]Git: How to find all branches that were never merged back into master
We have a fairly large GIT repo and I would like to remove branches that were never merged back into master. 我们有一个相当大的GIT仓库,我想删除从未合并回主人的分支。
The reverse is fine too - a way to list all branches that have been merged into master at some point. 反过来也很好 - 一种列出在某些时候合并为master的所有分支的方法。
I would like a get a list to begin with rather then simply deleting the branches right away, since some branches may be worth keeping still or have been in development more recently. 我希望得到一个列表,而不是立即删除分支,因为一些分支可能值得保持静止或最近在开发中。
So the question is: Is there a way to list all branches that never had any of their changes merged back into master ? 所以问题是:有没有办法列出所有从未将任何更改合并回主服务器的分支?
git help branch
says: git help branch
说:
With --contains, shows only the branches that contain the named commit
(in other words, the branches whose tip commits are descendants of the
named commit). With --merged, only branches merged into the named
commit (i.e. the branches whose tip commits are reachable from the
named commit) will be listed. With --no-merged only branches not merged
into the named commit will be listed. If the <commit> argument is
missing it defaults to HEAD (i.e. the tip of the current branch).
Hence, for finding all branches already merged to master you can use git branch --merged master
. 因此,为了找到已经合并为master的所有分支,你可以使用
git branch --merged master
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.