git log pretty examples |Video upload date:  · Duration: PT7M51S  · Language: EN

Quick guide to make git log output readable with oneline graph decorate and custom format commands for clearer commit history

Why bother with a pretty git log

Because scanning raw commit history should not feel like reading ancient rune tablets. The default git log is honest but loud and messy. Taming it with pretty formats and a couple of aliases makes your commit history usable again and saves you from squinting at full hashes all day.

Fast compact views to scan history

When you only need the gist use single line commits and a graph. These commands are the duct tape for quick reviews.

git log --pretty=oneline

git log --graph --oneline

git log --graph --decorate --oneline

The ASCII graph draws branches and merges so you can tell what actually happened without memorizing SHA patterns. The decorate flag shows branch and tag names next to commits which stops you from playing commit name roulette.

Custom formats when details matter

Want precise fields in a predictable order. Use the format string to show exactly what you care about. No guessing which column is what.

git log --pretty=format '%h %ad %an %s' --date=short

Replace placeholders if you need full hashes author email or commit body. For audits add body and machine friendly dates.

git log --pretty=format '%H %ad %an %s%n%b' --date=iso

Save aliases so you actually use these views

Typing a long command every time is a habit breaker. Store your favorite view as an alias and pretend you are organized.

git config --global alias.lg "log --graph --decorate --pretty=format '%C(yellow)%h%Creset %Cgreen%ad%Creset %C(cyan)%an%Creset %s' --date=short"

This alias gives you a colored compact history that is perfect for daily checks. Keep one alias for quick scans and another for deep audits.

git config --global alias.audit "log --pretty=format '%H %ad %an %s%n%b' --date=iso"

Little habits that pay off

  • Pick one or two formats that answer your common questions and stick with them
  • Use graph and decorate for branch context when reviewing merges
  • Use a full format with body and raw dates when you need to investigate a problem

Bottom line. Make git log work for you not the other way around. A couple of tidy formats and a pair of aliases will turn commit noise into a useful timeline and save you from another needless terminal facepalm.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.