简体   繁体   English

Git:如何找到所有从未合并回master的分支

[英]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 branch --no-merged master

Or for the other way, git branch --merged master 或者换句话说, git branch --merged master

docs 文档

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.

相关问题 如何以编程方式找到已使用git合并到master的分支? - How to programmatically find branches that were merged into master with git? Git:如何删除所有本地分支(合并与否),除了master和develop - Git : How to delete all local branches (merged or not), except master and develop 如何查找master中所有未合并的提交按照创建的分支分组? - How to find all unmerged commits in master grouped by the branches they were created in? Linux内核的稳定git分支是否合并回主服务器? - Are the Linux kernel's stable git branches merged back into master? Git命令查找哪些分支合并到当前分支以及何时合并 - Git command to find what branches were merged into current branch and when 如何从最后一个匹配的提交消息中获取合并到分支中的所有 git 分支 - How can I get all git branches that were merged in a branch from the last matching commit message 显示在 2 个日期之间合并到 Master 的所有分支 - Git - Show all branches merged to Master between 2 dates - Git Git:如何找到合并提交的分支? - Git: How to find which branches a commit was merged into? 如何获取合并到合并中的 git 分支的名称 - How to get the names of git branches which were merged into a merge Git:如何列出从特定日期合并到主控的所有远程分支/按日期排序 - Git : how to list all remote branches which ve been merged to master from a specific date / sorted by date
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM