压缩git log --graph输出?

3
有没有一种方法可以压缩 git log --graph 的输出,以便在遵循线性历史的提交时将其可视化压缩?基本上,我只想看到图形中一些分支分叉/合并的点,以获得关于我的分支结构是什么样子的顶层“概述”。例如,如果我有这个:
A
|
Z
|
H
|
B    G
|   /
C  F
| /
D
|
E

我希望它能显示类似以下的内容:

A    G
|   /
.. ..
| /
D
|
E

1
不确定这是否正是你想要的,但可以尝试使用 --simplify-by-decoration 参数。它只会显示被分支或标签引用的提交记录。 - undefined
1个回答

2
建立在Ismail Badawi评论之上,我喜欢:
git log --simplify-by-decoration --graph --format="%d"

git仓库本身上,这将会给出:
C:\Users\vonc\prog\git\git>git log --simplify-by-decoration --graph --format="%d"
*  (HEAD, origin/master, origin/HEAD, master)
*  (tag: v1.9.1)
*  (tag: v1.9.0)
*
|\
| *  (tag: v1.8.5.5)
* |  (tag: v1.9.0-rc3)
* |
|\ \
| |/
| *  (tag: v1.8.5.4)
* |  (tag: v1.9-rc2)
* |  (tag: v1.9-rc1)

略长:

稍微长一点:

git log --simplify-by-decoration --graph --pretty="format:%H%n" | git name-rev --stdin --name-only | less

多行显示:

git log --simplify-by-decoration --graph --pretty="format:%H%n" | \ 
  git name-rev --stdin --name-only | \
  less

Git repo本身上,这会给出:
C:\Users\vonc\prog\git\git>git log --simplify-by-decoration --graph --pretty="format:%H%n" | git name-rev --stdin --name-only | less
* master
|
* tags/v1.9.1^0
|
* tags/v1.9.0^0
|
*   tags/v1.9.0~2
|\
| |
| * tags/v1.8.5.5^0
| |
* | tags/v1.9.0-rc3^0
| |
* |   tags/v1.9.0-rc3~4
|\ \
| |/
| |
| * tags/v1.8.5.4^0
| |
* | tags/v1.9-rc2^0

请看这里(https://stackoverflow.com/a/70456061/6309),无标签。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接