[英]How do I find if a branch has been merged to any branch (not just a specific one)
I'm trying to clean up some branches in a fairly large project. 我正在尝试清理一个相当大的项目中的一些分支。 We essentially have master, a bunch of release branches (of which only the most recent is maintained), and feature/bug fix branches off each release. 本质上,我们拥有master,一堆发行分支(仅维护了最新的分支)以及每个发行版的功能/错误修复分支。
The process is normally bugfix/feature-branch -> current-release-branch -> master 该过程通常是bugfix / feature-branch-> current-release-branch-> master
Now I can see there's quite a few old feature/bugfix branches that are ahead of master - but what I want to do is find if they were at least merged to a release branch. 现在,我可以看到在master之前有很多旧的功能/错误修正分支-但是我想做的是查找它们是否至少合并到了发行分支中。
Then I can at least clean up all feature/bugfix branches which have been merged to release branches, leaving me to only manually work out a) what's missing in master that's on release-branches, and b) any feature branches that were never merged at all. 然后,我至少可以清理已合并到发行分支的所有功能/错误修正分支,而让我只能手动解决a)版本分支中的master缺少的内容,以及b)从未在此处合并的任何功能分支所有。
git branch -a --merged {commit}
to list all branches that are reachable from specified commit --no-merged
to list all non reachable branches git branch -a --merged {commit}
列出从指定提交可访问的所有分支--no-merged
列出所有不可访问的分支
That's what you need. 那就是你所需要的。
http://git-scm.com/docs/git-branch http://git-scm.com/docs/git-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 (ie 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 argument is missing it defaults to HEAD (ie the tip of the current branch)." “使用--contains,仅显示包含命名提交的分支(换句话说,其尖端提交是命名提交的后代的分支。)使用--merged,仅分支合并到命名提交中(即,其分支将列出列出的提交(可从指定的提交到达提示提交);使用--no-merged时,将仅列出未合并到指定的提交中的分支;如果缺少该参数,则默认为HEAD(即当前分支的提示)。 “
As simple as 就像
git branch -a --contains <id>
Where <id>
might be a changeset iв, a tag name or a branch name 其中<id>
可能是变更集i ?、标记名或分支名
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.