Git
Author and date
Learn to filter by commit author and date.
Filtering by author: --author
When multiple people collaborate on large projects, finding a specific contributor's commits becomes essential. The --author flag filters commits by author name or email address. This option is frequently paired with --oneline for concise view.
git log --author="Ahmet"
git log --author="ahmet@example.com" --oneline
You don't need to type the full author name; a partial match is also accepted.
Filtering by date: --since and --until
To find commits from a specific timeframe, use the --since and --until filters. Git understands exact dates like "2026-01-01" as well as natural expressions like "yesterday". Author and date options can be combined for targeted searches.
git log --since="2026-01-01"
git log --author="Elif" --since="1 week ago"
You can also use --after in place of --since, and --before in place of --until.
Exercise Filter commits by author
Use git log with --author="Burak" and --format="%s" to list only Burak's commit subject.
Show example solution
git init -q
git config user.name "Ali"
git config user.email "ali@example.com"
echo "1" > a.txt
git add a.txt
git commit -qm "Ali ilk commit"
git config user.name "Burak"
git config user.email "burak@example.com"
echo "2" > b.txt
git add b.txt
git commit -qm "Burak ikinci commit"
git config user.name "Ali"
git config user.email "ali@example.com"
echo "3" > c.txt
git add c.txt
git commit -qm "Ali ucuncu commit"
git log --author="Burak" --format="%s"
Test yourself
-
Which command is used to filter only the commits made by an author named "Elif"?
- git log --author="Elif"
- git show --committer="Elif"
- git diff --author="Elif"
- git log --user="Elif"
Show answer
git log --author="Elif" — git log --author filters commits whose author name or email address matches the given pattern.
-
Filter by start date
git log ____="2026-01-01"
Show answer
git log --since="2026-01-01"
-
Filtering options
- --author
- Filters by author
- --since
- Takes commits after a date
- --until
- Takes commits until a date
- --grep
- Searches commits by message
Next lesson: Summary - Viewing history