Viewing History
See commit history
git log
git log --oneline # Compact, one line per commit
git log --oneline --graph # ASCII graph of branches
git log -n 5 # Last 5 commits
git log --author="Ana" # Filter by author
See what changed
git diff # Unstaged changes vs last commit
git diff --staged # Staged changes vs last commit
git diff HEAD~1 HEAD # Compare two commits
git diff file.txt # Changes in one file
Reading a diff
- old line (removed, shown in red)
+ new line (added, shown in green)
Show a specific commit
git show a1b2c3d
See who changed each line
git blame file.txt