bashintermediate
Git Log — Search, Filter, and Visualize
Advanced git log techniques for searching commit messages, filtering by author/date, and visualizing.
bashPress ⌘/Ctrl + Shift + C to copy
# Search commit messages
git log --grep="fix" --oneline
# Search by author
git log --author="Jane" --oneline --since="2024-01-01"
# Search code changes (pickaxe: find when string was added/removed)
git log -S "functionName" --oneline
# Search with regex in code
git log -G "TODO|FIXME|HACK" --oneline
# Graph visualization
git log --graph --oneline --all --decorate
# Custom format
git log --pretty=format:'%C(yellow)%h%Creset %C(blue)%ad%Creset %C(green)%an%Creset %s' \
--date=short -20
# Show files changed per commit
git log --stat --oneline -10
# Commits touching a specific file
git log --oneline --follow -- src/auth.ts
# Commits between two tags/branches
git log v1.0..v2.0 --oneline
# Commits in branch-A but not in main
git log main..feature/auth --oneline
# Shortlog (summary by author)
git shortlog -sn --since="2024-01-01"
# First parent only (skip merge internals)
git log --first-parent --oneline main
# Show merge commits only
git log --merges --oneline -10Use Cases
- Searching project history for specific changes
- Generating changelogs and release notes
- Auditing who changed what and when
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
bashbeginner
Git Log Formatting Tricks
Custom git log formats with graphs, filtering by author, date ranges, and file changes.
Best for: Reviewing project history efficiently
#git#log
bashintermediate
Squash Multiple Git Commits
Interactive rebase to squash multiple commits into one clean commit before merging a feature branch.
Best for: Cleaning up messy commit history
#git#squash
bashadvanced
Git Interactive Rebase Guide
Interactive rebase to reorder, edit, drop, and squash commits for a clean Git history.
Best for: Crafting a clean commit history before merge
#git#rebase
bashintermediate
Git Blame Investigation Techniques
Use git blame and related tools to trace code authorship and understand change history.
Best for: Finding who introduced a bug
#git#blame