n个git分支之间的关系
如果我有 n 个 git 分支,如何轻松显示这些分支之间的关系?
基本上我有兴趣查看存储库中所有分支的子集的树。然而,我对所有中间提交不感兴趣。
例如:我的存储库看起来像这样:
o---o--o A
/ /
o--o--o--o--o--o B
\ \ \
\ o--o C \
\ \ \
o--o--o--o--o--o D
但可能更复杂。现在我想查看分支 A、C 和 D 之间的关系。大致如下:
o A
/
o--o--o
\ \
o---o C
\
o--o D
或等效概述。这可能吗?如何实现? (图形工具就可以了。)
解决方案
基于 Antoine Pelisses 的回答,下面的行似乎(几乎)正是我想要的:
git log --graph --decorate --oneline --simplify-by-decoration A B C
更新
Mark Longair 指出在他下面的回答中, gitk 接受与 git rev-list 相同的参数,因此可以这样做:
gitk --simplify-by-decoration A C D
If I have n git branches, how do I easily show the relationship between these branches?
Basically I am interested in seeing a tree of a subset of all the branches in my repository. I am however not interested in all the intermediate commits.
E.g.: My repository looks like this:
o---o--o A
/ /
o--o--o--o--o--o B
\ \ \
\ o--o C \
\ \ \
o--o--o--o--o--o D
But probably way more complicated. Now I want to see the relationship between branch A, C and D. Something along the lines of:
o A
/
o--o--o
\ \
o---o C
\
o--o D
Or an equivalent overview. Is this possible, and how? (A graphical tool will be just fine.)
Solution
Based on Antoine Pelisses answer, the below line seems to do (almost) exactly what I want:
git log --graph --decorate --oneline --simplify-by-decoration A B C
Update
Mark Longair points out in his answer below that gitk
accepts the same parameters as git rev-list
, so it is possible to do:
gitk --simplify-by-decoration A C D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试一下:
它只会显示分支头或标记的提交。
You can give this a try:
It will only show commits that are branch heads or tagged.
我会使用:
...可能还有其他 git GUI 可以生成更漂亮的提交图渲染,但我总是发现 gitk 适合此目的。所有分支和标签都以“伦敦地铁”样式表示形式进行标记:
(来源:在 mythic-beasts.com 标记)< /sub>
您还可以使用
gitk
的--simplify-by-decoration
选项,因为它理解git rev-list
的所有参数code> 例如:I would use:
... there are probably other git GUIs that produce a prettier rendering of the commit graph, but I've always found
gitk
fine for this purpose. All the branches and tags are labelled in the "London Underground"-style representation:(source: mark at mythic-beasts.com)
You can also use the
--simplify-by-decoration
option togitk
, since it understands all of the parameters thatgit rev-list
does, for example: