In this lesson, you will learn how to pinpoint exactly who contributed to your project and when, by applying filters to your commit history.
When a project grows, the git log command can become overwhelming. Instead of scrolling through hundreds of entries, you can use flags to extract only the information you need.
Filtering by Author
If you are working on a team and want to see only the contributions made by a specific person, you can use the --author flag. Git will search the metadata of each commit and display only those created by the name or email address you provide.
Try running this in your terminal:
git log --author="Jane Doe"
Filtering by Date
To narrow your view to a specific timeframe, Git offers several date-based flags: --since, --until, --after, and --before. You can use these to define a window of time. For example, if you want to see all the work done within the last week, you can use:
git log --since="1 week ago"
You can even combine these flags to create very specific reports. For instance, if you want to see what a teammate named "John" worked on during a specific month, you could combine the filters:
git log --author="John" --since="2023-10-01" --until="2023-10-31"
Why This Matters
By mastering these filters, you turn your project history from a long, confusing list into a powerful search engine. Whether you are debugging an issue that started recently or performing a code review of a specific person’s work, these tools help you find the "who" and the "when" of your project's development in seconds.
Key Takeaway: Use the --author, --since, and --until flags with git log to narrow your history and focus on specific contributions within your desired timeframe.