查找未合并的Git分支? [英] Find unmerged Git branches?

查看:504
本文介绍了查找未合并的Git分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含许多分支的Git存储库,其中有些已经合并,有些还没有。由于分支的数量很大,如何确定尚未合并的分支?我想避免不必进行章鱼合并和重新合并已经合并的分支。

I have a Git repository with many branches, some of them already merged and some not. Since the number of branches is quite large, how can I determine which branches have not yet been merged? I would like to avoid having to do an "octopus" merge and re-merging branches that have already been merged.

推荐答案

尝试

git branch --merged master

它按照锡盒上的说明进行操作(列出已合并到 master 中的分支)。您还可以使用以下方法拉反函数:

It does what it says on the tin (lists branches which have been merged into master). You can also pull up the inverse with:

git branch --no-merged master

如果您未指定 master ,例如。

git branch --merged

然后它将向您显示已合并到当前 HEAD 的分支(因此,如果您使用的是 master ,它等效于第一个命令;如果您使用的是 foo ,则等效于 git branch --merged foo )。

then it will show you branches which have been merged into the current HEAD (so if you're on master, it's equivalent to the first command; if you're on foo, it's equivalent to git branch --merged foo).

您还可以通过指定 -r 标志和要检查的引用来比较上游分支可以是本地的也可以是远程的:

You can also compare upstream branches by specifying the -r flag and a ref to check against, which can be local or remote:

git branch -r --no-merged origin/master

这篇关于查找未合并的Git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆