wch*_*wch 78 git branch git-log git-branch
假设您的git commit历史如下所示:
A---B---C---D---E---F master
\ /
X---Y---Z topic
Run Code Online (Sandbox Code Playgroud)
是否可以让git列表只有master,AF上的提交?换句话说,如果提交是在合并分支上,我不希望它显示.
Cha*_*esB 123
git log有选择权--first-parent,所以你不会得到topic历史.
合并后master,master提交是合并中的第一个父项.Git log只允许使用--first-parent显示那些提交,所以你得到了正确的东西.
UpA*_*dam 19
还有另一种通用方法可以解决这个问题,它不依赖于--first-parent在某些情况下有用的方法.使用分支排除过滤器
git log origin/topic ^origin/master 这将为您提供删除origin/topic所有origin/master提交的日志.
你也可以添加--no-merges隐藏你可能想要或不想要的合并提交.
另一个方便的提示是使用shortlog而不是使用log它将为您提供更多的简化摘要,这些摘要可以方便发行说明,或者在分支中进行通信.
更新
重新阅读之后,你实际上想要几乎与我发布的相反; 但它最终会排除master和foo(git log origin/master ^origin/foo)上的所有内容.但是你也可以得到你要求的东西(隐藏所有合并的提交)git log origin/master --no-merges
| 归档时间: |
|
| 查看次数: |
41472 次 |
| 最近记录: |