Skip to main content

Command Palette

Search for a command to run...

The "best" git log command

Updated
1 min read
The "best" git log command

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

It gives you a graph, commit hash (red), decorations like branch names (yellow), commit subject / message (white), relative time (green), and author name (blue, wrapped in < >).

Make it an alias so you can just type git lg:
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Of course there are definitely nicer looking options in VS Code, VS Code extensions, stand alone Git GUIs, etc., but this is one of the best git log options to just run it from the terminal.