git发现没有分支的分支 [英] git finding unmerged branches

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

问题描述

我有一个拥有许多分支的git仓库,其中一些已经合并,另一些则不合并。由于分支机构的数量很大,我怎么知道哪些分支机构尚未合并?我会避免做一个章鱼合并重新所有的分支再次。

解决方案

试试这个:

  git branch --merged master 

它在锡上显示的内容(列出了已被合并到 master 中的分支)。你也可以通过以下方式来取消:

  git branch --no-merged master 

如果您不指定 master ,例如..

  git branch --merged 



<那么它会显示你已经合并到当前 HEAD 的分支(所以如果你在 master ,它相当于第一个命令;如果你使用 foo ,它相当于 git branch --merged foo )。

您也可以通过指定 -r 标志和一个ref来检查上游分支,可以是本地的或远程的:

  git分支-r  - 不合并的原点/主


I've got a git repository with many branches, some of them already merged and some not. Since the number of branches is quite big, how can I know which branches have not been merged yet? I would avoid to do an octopus merge remerging all the branches again.

解决方案

Try this:

git branch --merged 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

If you don't specify master, e.g...

git branch --merged

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).

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天全站免登陆