Filtering Log Results
Basic Filtering Techniques
Filtering by Author
## Show commits by specific author
git log --author="John Doe"
Filtering by Commit Message
## Find commits with specific keyword
git log --grep="bugfix"
Advanced Filtering Methods
Date-Based Filtering
## Commits within specific date range
git log --since="2 weeks ago" --until="yesterday"
Commit Range Filtering
## Commits between two references
git log main..feature-branch
Filtering by File Changes
Commits Affecting Specific File
## Log for specific file
git log -- path/to/file.txt
Commits with File Modifications
## Commits with specific file changes
git log --name-status
Complex Filtering Combinations
## Multiple filter conditions
git log --author="Jane" --since="2023-01-01" --grep="feature"
Filtering Options Overview
Filter Option |
Description |
--author |
Filter by commit author |
--grep |
Search commit messages |
--since/--until |
Date-based filtering |
--name-status |
Show file changes |
Visualization of Commit Filtering
flowchart LR
A[All Commits] --> B{Filter Conditions}
B -->|Author| C[Filtered by Author]
B -->|Date| D[Filtered by Date]
B -->|Message| E[Filtered by Message]
Practical Filtering Scenarios
Recent Team Contributions
## Last week's team commits
git log --since="1 week ago" --author="team@company.com"
Tracking Specific Changes
## Commits related to specific feature
git log --grep="authentication" --name-status
At LabEx, we emphasize the power of precise log filtering to enhance code review and project tracking.