简体   繁体   English

如何查找分支是否已合并到任何分支(不仅是特定分支)

[英]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.

相关问题 当另一个分支合并到一个分支中时,如何查找更改的文件(忽略合并分支中的更改)? - How to find the files changed in one branch when another has been merged into it (ignoring changes from the merged branch)? 如何检查master是否已合并到当前分支 - How do I check if master has been merged into current branch 如何找到请求合并的分支? - How do I find the branch a branch requested to be merged into? 我如何知道一个分支是否已经合并到 master 中? - How can I know if a branch has been already merged into master? Git:如何删除已经提交,推送并合并到master的分支? - Git: How do I remove a branch that has already been committed, pushed, and merged into master? 我怎么知道分支是否已经在SVN / Mercurial / Git中合并? - How do I know if a branch has already been merged in SVN/Mercurial/Git? 当合并分支已合并并已恢复时,如何强制进行合并提交? - How do I force a merge commit when the branch being merge has been merged and reverted already? Git - 如何查看分支是否已合并到另一个分支? - Git - How to see if a branch has EVER been merged into another branch? 该(重新设置的)分支是否已合并? - Has this (rebased) branch been merged? 如何检查分支是否已合并到另一个分支? - How can I check whether a branch has been merged into another branch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM