Git:如何在此分支上列出提交,但不是从合并分支中列出提交 [英] Git: How to list commits on this branch but not from merged branches

查看:151
本文介绍了Git:如何在此分支上列出提交,但不是从合并分支中列出提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你的git提交历史记录如下所示:

  A --- B --- C --- D- --E --- F master 
\ /
X --- Y --- Z topic

是否有可能让git只列出主控器AF上的提交?换句话说,如果提交是在一个合并分支上,我不希望它显示。

解决方案

git log 有选项 - first-parent ,所以你不会得到 topic history。



当从 master 合并时, master commit是合并的第一位父母。 Git log允许仅显示那些使用--first-parent的提交,这样你就可以得到正确的东西。


Suppose your git commit history looks like this:

A---B---C---D---E---F master
     \         /
      X---Y---Z topic

Is it possible to have git list only the commits on master, A-F? In other words, if the commit was on a merged-in branch, I don't want it show.

解决方案

git log has option --first-parent, so you won't get topic history.

When merged from master, the master commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff.

这篇关于Git:如何在此分支上列出提交,但不是从合并分支中列出提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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