git_detailed_history
git detailed history
Advanced history navigation and analysis.
π Log Formats
One Line
git log --oneline
Compact: hash + message.
Graph View
git log --graph --oneline --all
Visual branch structure.
With Diff
git log -p
Shows patch for each commit.
With Stats
git log --stat
Shows files changed per commit.
π Filter by Author
By Name
git log --author="John"
Commits by author containing "John".
By Email
git log --author="john@email.com"
Commits by specific email.
π Filter by Date
Since Date
git log --since="2024-01-01"
Commits after date.
Until Date
git log --until="2024-06-01"
Commits before date.
Relative Date
git log --since="2 weeks ago"
Commits from last 2 weeks.
π¬ Filter by Message
By Message Content
git log --grep="bug fix"
Commits with "bug fix" in message.
Case Insensitive
git log --grep="bug" -i
Case insensitive search.
π Filter by File
By Path
git log -- path/to/file.txt
Commits touching this file.
Follow Renames
git log --follow -- path/to/file.txt
Tracks file through renames.
π Filter by Code
By Code Change (Pickaxe)
git log -S "function_name"
Commits that added/removed this string.
By Regex
git log -G "pattern.*match"
Commits matching regex pattern.
π€ git blame
See Line Authors
git blame file.txt
Shows who last modified each line.
Specific Lines
git blame -L 10,20 file.txt
Blame only lines 10-20.
Ignore Whitespace
git blame -w file.txt
Ignores whitespace changes.
π Statistics
Commits by Author
git shortlog -sn
Commit count by author.
With Emails
git shortlog -sne
Includes email addresses.
π Custom Format
Format Placeholders
| Placeholder | Meaning |
|---|---|
%H |
Full hash |
%h |
Short hash |
%an |
Author name |
%s |
Subject |
%ar |
Relative date |
Custom Format Example
git log --pretty=format:"%h %an %s"
Short hash, author, subject.
Colored Output
git log --pretty=format:"%C(yellow)%h%Creset %s"
Yellow hash, normal subject.
π‘ Tips
Create Log Alias
git config --global alias.lg "log --oneline --graph --all"
Find Deleted Code
git log -S "deleted_code" --all
π Related
#git #log #history #blame #internals