我见过一些书籍和文章中有一些非常漂亮的Git分支和提交的图表。如何制作Git历史的高质量可打印图像?
当前回答
我建议tighttps://github.com/jonas/tig,一个更好的Git命令行工具。
您可以使用Homebrew在macOS上安装tig:
$ brew install tig
$ tig
其他回答
有一个时髦的Git提交图作为Raphael web图形库的演示之一。
这个演示是静态的,但应该很容易获取代码并将静态数据交换为一组实时数据——我认为这只是JSON格式的Git提交数据。
演示在这里:http://dmitrybaranovskiy.github.io/raphael/github/impact.html
稍微调整一下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
这里的许多答案都很好,但对于那些只想得到一个简单的一行到位的答案而不必设置别名或其他任何东西的人来说,这里是:
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
即使您关闭并重新打开它,也可以从该提示中删除。
我不知道有什么直接的工具,但也许你可以破解一个脚本,将数据导出为点格式,并用Graphviz渲染。
Gitgraph.js允许在没有存储库的情况下绘制漂亮的Git分支。只需编写一个JavaScript代码来配置分支和提交并在浏览器中呈现。交互式文档可用。
var gitGraph = new GitGraph({
template: "blackarrow",
mode: "compact",
orientation: "horizontal",
reverseArrow: true
});
var master = gitGraph.branch("master").commit().commit();
var develop = gitGraph.branch("develop").commit();
master.commit();
develop.commit().commit();
develop.merge(master);
或使用地铁模板:
或者使用提交消息、作者和标签:
用JSFiddle测试它。
通过@bsara使用GitGraper生成它。
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式
- git pull -rebase和git pull -ff-only之间的区别