Skip to content
Afa' Afa'

Git Cheat Sheet

Readable git log commands for visualising history as a graph with tags, authors and relative dates.

1 min read Updated

These commands render git log as a compact graph, first with tags and refs, then with author, relative date and decorated refs. They are handy when you want a readable overview of a branch's history from the terminal. The shell lines below can be copied into a script or typed directly.

Display git log with graph

git-cheat-sheet.sh

bash
# display git log with graph: tags
git log --graph --oneline --decorate --all

# display git log with graph: authors and date
git log --graph \
  --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' \
  --abbrev-commit --date=relative --all
Something wrong or want to discuss this article? Get in touch

Search articles and projects

Type to filter articles and projects. Use the arrow keys to move through results and Enter to open one. Press Escape to close.