How to get the git commit tree?

Posted on In QA

How to get a tree-like view of the git commit history?

My favorite command line:

git log --graph --oneline

It will prints a text based graph like (with colors):

*   b5dc8b9 Merge branch 'master' of https://github.com/layerzero/libi0
|  
| * 7514ef1 revised the README.md a little bit
| * 6692428 align size to page for both shalloc and shalloc_ext as default behavior
| * 892e097 add PAGE_SIZE macro to indicate page size; other macros should use this instead of define their own
| * de68119 shalloc: default behavior made to be standalone for each call to shalloc
* | 2d84c94 Add some output functions
|/  
* e27c0b1 bugfix: input_q respects - even it reaches EOF
* 4e45dc3 add libi0 and LICENSE

If you want the full commit hash code:

git log --graph --pretty=oneline

The output will be like:

*   b5dc8b9542aa5f6f52af826e857410c2f4db6028 Merge branch 'master' of https://github.com/layerzero/libi0
|  
| * 7514ef1b968aff028a1975c8cfdd3d7efc7b9c36 revised the README.md a little bit
| * 6692428cf84a4258ed96952e66d379fe59dffbc1 align size to page for both shalloc and shalloc_ext as default behavior
| * 892e0978944c2ad06ba11752897f162724577a23 add PAGE_SIZE macro to indicate page size; other macros should use this inste
| * de681193ab4392da7666c6ecf34a5d207ab8c299 shalloc: default behavior made to be standalone for each call to shalloc
* | 2d84c9431bbb57d2642a3c9f46a0b3b4f2faed4f Add some output functions
|/  
* e27c0b1c7c2e57316c718c2e27c3d76052872668 bugfix: input_q respects - even it reaches EOF
* 4e45dc3bd70348d955fa0a3e9835ac88d272247e add libi0 and LICENSE

If you are okay with GUI tools, try the git repository browser gitk.

gitk

Leave a Reply

Your email address will not be published. Required fields are marked *