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
P

Full stack software engineer building a financial data integration SaaS product. Led a complete rebuild of the team’s web app using JavaScript, TypeScript, React, C#/.NET, EntityFramework Core and SQL, with testing in Jest, React Testing Library, xUnit, and Moq. Utilized AWS services including MySQL RDS, EC2, ECS with Docker, S3, Lambda, and EventBridge.

Passionate about continuous improvement, clean code, and best practices (where they exist). Dedicated rock climber and runner based in Colorado. Names variables like a first born child.

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.