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

git log tree author

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.

Luckliy we have a log format for that:

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

It will show branch tree like below:

git branch tree

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'

All done!