DEV Community

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Visualize Git Branch Tree

We saw how we can visualize our commits with tree-like graph in the post Visualize Git Log Tree.

git visualize log tree

Okay but sometimes I only need branch names, since I create and add bunch of feature or fixing bugs — a.k.a another feature. Therefore I want to know which branch is the up-to-date one or where this branch comes from. I
wanna see the branch relations.

Luckily we have a log format for that:

$ git log --graph --simplify-by-decoration --pretty=format:'%d' --all
Enter fullscreen mode Exit fullscreen mode

It will show branch tree like below:

git branch visualize

Alias

An alias will be useful for this command since I'm gonna use it a lot.

alias glb='git log --graph --simplify-by-decoration --pretty=format:'%d' --all'
Enter fullscreen mode Exit fullscreen mode

All done!

Top comments (0)