601 B
601 B
Viewing the Commit History
Goal
Inspect commit history in different formats and levels of detail.
Basic Log
cd ~/lab-git-essentials/my-first-repo
git log
One-Line, Decorated, with Graph
git log --oneline --decorate --graph --all
Show a Specific Commit
# Copy a commit SHA from the log
git show <SHA>
Filter by File or Author
git log -- README.md
git log --author "Your Name"
Statistics and Patches
git log --stat -n 5
git log -p -n 1
Outcome
You can read history, view diffs, and filter logs by file or author.