CodeBlanks Logo Icon CodeBlanks

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.

Practice Filter commits by author

Use git log with --author="Burak" and --format="%s" to list only Burak's commit subject.

Starter code

terminal
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"

# Filtreleme komutunu buraya yaz

Sample solution

terminal
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"

Expected output

Burak ikinci commit

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which command is used to filter only the commits made by an author named "Elif"?

  • git log --author="Elif" Correct answer
  • git show --committer="Elif"
  • git diff --author="Elif"
  • git log --user="Elif"

Explanation: git log --author filters commits whose author name or email address matches the given pattern.

2 Filter by start date

Question
git log ____="2026-01-01"
Answer
git log --since="2026-01-01"

Explanation: The --since flag lists commits made after the specified date.

3 Filtering options

Term Meaning
--author Filters by author
--since Takes commits after a date
--until Takes commits until a date
--grep Searches commits by message

All lessons in Beginner