我见过一些书籍和文章中有一些非常漂亮的Git分支和提交的图表。如何制作Git历史的高质量可打印图像?
当前回答
gitg:基于gtk的存储库查看器。这是新的,但有趣且有用。
我目前正在使用它。
其他回答
我编写了一个web工具,用于将Git日志转换为漂亮的SVG图形:
Bit Booster-离线提交图形绘制工具
将git-log的输出--prey='%h|%p|%d'直接上载到工具中,然后单击“download-grap.svg”链接。
该工具是纯客户端的,因此您的Git数据不会与我的服务器共享。您还可以在本地保存HTML+JavaScript,并使用“file:///”URL运行它。它在Ubuntu 12.04(精确穿山甲)上的Chrome 48和Firefox 43上进行了验证。
它生成的HTML可以直接发布到任何页面(包括blogspot博客引擎!)。看看这里的一些博客帖子:
http://bit-booster.blogspot.ca/
下面是该工具生成的示例HTML文件的屏幕截图:
http://bit-booster.com/graph.html(工具)
看着这段对话,我试着用我最喜欢的git可乐和git dag。
正在运行视图->DAG。。。从git-cola中删除并替换Log:master-with-都显示了一个包含所有分支的漂亮图形。
基于我在回答相关问题时发现的Graphviz脚本,我黑了一个Ruby脚本,该脚本创建了Git存储库的摘要视图。它消除了所有的线性历史,只显示“有趣的”提交,即那些有多个父母、多个子女或由分支或标记指向的提交。下面是它为jQuery生成的图形片段:
git big picture和BranchMaster是类似的工具,它们试图通过仅显示标记、分支、合并等的关联方式,仅显示图形的高级结构。
这个问题还有其他选择。
稍微调整一下Slipp的精彩回答,你可以使用他的别名记录一个分支:
[alias]
lgBranch1 = log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lgBranch2 = log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
lg = !"git lg1"
你现在可以做的一切
git lgBranch1 <branch name>
甚至
git lgBranch1 --all
文件~/.oh-my-zsh/plugins/git/git.plugin.zsh中的一些别名:
gke='\gitk --all $(git log -g --pretty=%h)'
glg='git log --stat'
glgg='git log --graph'
glgga='git log --graph --decorate --all'
glgm='git log --graph --max-count=10'
glgp='git log --stat -p'
glo='git log --oneline --decorate'
glog='git log --oneline --decorate --graph'
gloga='git log --oneline --decorate --graph --all'
glol='git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit'
glola='git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all'