如何在GIT中构建标签树? [英] How to build a tag tree in GIT?
问题描述
作为GIT的频繁用户,我喜欢 git log --graph
就像我喜欢 git tag
一样.我要负责一个拥有太多分支和标签的大型GIT存储库,并且我使用 sisyphusian进行的过程太慢减少这些数字的工作.
As frequent GIT user, I love git log --graph
as much as I love git tag
. I was made responsible for a large GIT repository with too many branches and tags and I am proceeding too slowly with the sisyphusian work of reducing those numbers.
像通常的提交图一样,具有标签树图会非常有帮助,但是仅包含带有标签的分支.我还需要每个标记的提交的哈希(理想情况下还需要时间戳和作者).
It would be extremely helpful is to have a tag tree graph, just like a usual commit graph, but only with those branches which have tags on it. I would also need the hash of each tagged commit (and ideally also the time-stamp and author).
我进行了很多搜索,但没有找到我所描述的内容.
I searched a lot, but I never found anything like what I described.
推荐答案
正如 Amadan 指出的那样,我本该跳水在最新版本中更深入地了解 git-log文档.解决方案就是简单地包含-simplify-by-decoration
标志.总之,我得出以下结论
As Amadan pointed out, I should have dived deeper into the git-log documentation in the most recent version. The solution is simply to include the --simplify-by-decoration
flag. Altogether, I ended up with the following
git log --graph --simplify-by-decoration --pretty=format:'%C(yellow)%h %ad %an%Cgreen%d %Creset%s' --date=short
官方格式文档解释了--pretty = format:'...'
,最重要的部分是
The official formatting documentation explains all the details of --pretty=format:'...'
, the most important parts are
-
%h
=缩写提交哈希 -
%an
=作者姓名 -
%ad
=作者日期 -
%s
=主题
%h
= abbreviated commit hash%an
= author name%ad
= author date%s
= subject
如果要记住一些东西,只需使用
If want something to memorize, just use
git log --graph --simplify-by-decoration
这为您提供的输出仅包含提交哈希和git-tag.
This gives you an output without of commit hash and git-tag only.
这篇关于如何在GIT中构建标签树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!