Git Log and History
5 min read Quiz at the end
Explore commit history with git log, blame, show, and search by message, author, or content.
Exploring Git History
git log
git log --oneline
git log --oneline --graph --all --decorate
git log -10 # last 10 commits
git log --since="2 weeks ago"
git log --author="Alice"
git log -- file.txt # commits touching file
# Show commit details
git show abc1234
git show HEAD~2 # 2 commits ago
# Search commits
git log --grep="bug fix"
git log -S "function name" # commits that added/removed text
# Who changed what
git blame file.txt
git blame -L 10,20 file.txt # lines 10-20
# File history
git log --follow -- src/app.js
Topic Quiz · 1 questions
Test your understanding before moving on
1. What does git blame show?
💡 git blame shows commit hash, author, and date for every line in a file.