DEV Community

loading...

Visualize Git Branch Tree

serhatteker profile image Serhat Teker Originally published at tech.serhatteker.com on ・1 min read

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

git log

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!

Discussion (0)

Forem Open with the Forem app