n个git分支之间的关系 [英] Relationship between n git branches

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

问题描述

如果我有n个git分支,我该如何轻松显示这些分支之间的关系?



基本上我有兴趣看到我的存储库中所有分支的子集。我对所有的中间提交并不感兴趣。



例如:我的资料库看起来像这样:

<$ p

$ b 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  - 简化装饰ABC 

更新



Mark Longair在他的回答中指出, gitk 接受与相同的参数git rev- list ,所以可以这样做:

  gitk --simplify-by-decoration ACD 


解决方案

您可以试试这个:

  git log --graph --all --decorate  - 简化装饰

它只显示分支头或提交的提交。


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

解决方案

You can give this a try:

git log --graph --all --decorate --simplify-by-decoration

It will only show commits that are branch heads or tagged.

这篇关于n个git分支之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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