显示直接向分支提交的提交,忽略Git中的合并 [英] Showing commits made directly to a branch, ignoring merges in Git

查看:136
本文介绍了显示直接向分支提交的提交,忽略Git中的合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用git时,有没有办法显示对分支进行的提交,而忽略所有通过合并提交的提交?

我试图回顾在分支上做出的代码更改,同时忽略了我们在其他合并的分支上所做的更改。我知道它几乎不可能显示一个差异,但我希望能够找出哪些提交我需要审查。

解决方案

父母在git的许多环境中都具有相同的权重。如果您在合并其他更改时始终保持一致,那么您可能会发现这会给您提供所需的内容。

  git log --no-merges --first-parent 

否则,您可以排除其他命名提交

  git log --no-merges ^ other-branch-1 ^ other-branch-2 ^ other-branch- 3 

如果您想查看要合并回主体分支的更改,最简单的做法是在本地克隆上执行合并,然后在发布合并之前查看第一个父级的差异。


When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging?

I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches that were merged in. I know it's damn near impossible to show a diff in that fashion, but I'd like to be able to find out which commits I need to review.

解决方案

Both parents have equal weight in many contexts in git. If you've always been consistent in merging other changes in then you may find that this gives you what you want.

git log --no-merges --first-parent

Otherwise you may be able to exclude commits from other named branches.

git log --no-merges ^other-branch-1 ^other-branch-2 ^other-branch-3

If you want to review the changes that you are going to merge back into a principal branch then the easiest thing to do is to perform the merge on a local clone and then just look at the diff with the first parent before publishing the merge.

这篇关于显示直接向分支提交的提交,忽略Git中的合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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