Git log: view the commit history
git log is your window into the project history. Who did what, when, and why. Discover the options to navigate commits efficiently.
The most useful git log options
--onelineOne line per commit (short hash + message)
--graphDraw the branch graph in ASCII
--allShow all branches, not just the current one
--author="name"Filter by author
--grep="word"Search in commit messages
--statList modified files per commit
-pShow the full diff for each commit
-nLimit to the last n commits (e.g., -5)
--since="2 weeks ago"Commits since a given date
Git log in practice
Different ways to browse the history.
Simple history
Branch graph
Filters and search
The ultimate alias: git lg
Most developers create an alias for a readable history in one command:
git config --global alias.lg "log --oneline --graph --all --decorate"Then simply type git lg for a complete visual history.
Part of the Git Basics guide
GitQuest is created by Anaïs (nouvelle fenêtre), web developer and head of education, specializing in tech training and digital accessibility.
Questions about git log
Explore the history in GitQuest
GitQuest investigations require you to navigate the history to solve mysteries.
Start the investigations