Diego Betto
Git log - A dog

Diego Betto · January 17, 2024 · 1 min di lettura

Git log with graph and decorations

A mnemonic trick to remember the parameters of git log --all --decorate --oneline --graph: think of the phrase A Dog.

Condividi:XLinkedInFacebookWhatsApp

How do you remember the list of parameters to add to the git command to display the graph with all the information from the terminal?

Just remember A Dog.

That is: “A Dog” = git log –all –decorate –oneline –graph

What each parameter does

  • --all: shows commits from every branch, not just the current one
  • --decorate: adds branch and tag names next to the commits they point to
  • --oneline: compresses each commit to a single line (short hash + message)
  • --graph: draws the tree structure, with merges between branches clearly visible

Put together:

git log --all --decorate --oneline --graph

Save it as an alias

So you don’t have to type it out every time, save it as a Git alias:

git config --global alias.lg "log --all --decorate --oneline --graph"

From then on, just type git lg to get the same view.

Condividi:XLinkedInFacebookWhatsApp
Diego Betto

Written by

Diego Betto

Co-Founder & CTO at PAPION. Senior full-stack engineer specializing in React, TypeScript, Node.js, and application security.