我见过一些书籍和文章中有一些非常漂亮的Git分支和提交的图表。如何制作Git历史的高质量可打印图像?


当前回答

我不知道有什么直接的工具,但也许你可以破解一个脚本,将数据导出为点格式,并用Graphviz渲染。

其他回答

我不知道有什么直接的工具,但也许你可以破解一个脚本,将数据导出为点格式,并用Graphviz渲染。

除了“Slipp D.Thompson”的答案外,我建议您添加此别名以具有相同的装饰,但通过提交将其添加到单行中:

git config --global alias.tre "log --graph --decorate --pretty=oneline --abbrev-commit --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'"

gitg:基于gtk的存储库查看器。这是新的,但有趣且有用。

我目前正在使用它。

这里的许多答案都很好,但对于那些只想得到一个简单的一行到位的答案而不必设置别名或其他任何东西的人来说,这里是:

git log --all --decorate --oneline --graph

不是每个人都会一直做git日志,但当你需要它时,请记住:

“A Dog”=git log--all--decorate--oneline--graph

如果您输入

git config --global alias.adog "log --all --decorate --oneline --graph"

在命令提示符下,可以使用

git adog

即使您关闭并重新打开它,也可以从该提示中删除。

这里是我的社区别名:gitls。使用gitls,您可以查看图形,每次提交只覆盖一行。一切都是彩色的,并带有有用的信息。您还可以检查其他分支上的提交历史记录:

git config --global alias.ls '!f() { git log $1 --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%ae,%ar]" --decorate --graph; }; f'

用法:

# shows commits graph on the current branch
git ls

# shows commits graph on the develop branch
git ls develop 

以下是图表视图: