CodeBlanks Logo Icon CodeBlanks

--since --until

Learn to query commits with date filters.

Date Filters: --since and --until

With the --since and --until options in git log, you can filter commit history by a date range. --since selects commits after the specified date, while --until selects commits before the specified date. This lets you inspect only the changes within a period of interest.

git log --since="2026-01-01"
git log --until="2026-06-30"

Use a Date Range Together

You can use --since and --until together in the same command to define start and end dates. Git displays only commits that match this range. Writing dates in the YYYY-MM-DD format provides a clear and readable approach.

git log --since="2026-03-01" --until="2026-03-31"

This command filters commit history for March 2026.

Practice Filter History for a Specific Month

Assign a Git command to command that displays commits from April 2026. Use --since for the starting date and --until for the ending date. Print the command.

Starter code

terminal
// Nisan 2026 tarih filtresini oluştur
const command = "";

// Komutu yazdır

Sample solution

terminal
const command = 'git log --since="2026-04-01" --until="2026-04-30"';
console.log(command);

Expected output

git log --since="2026-04-01" --until="2026-04-30"

Questions and answers

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

1 Which option is suitable for viewing only commits after June 1, 2026?

  • --since="2026-06-01" Correct answer
  • --format="2026-06-01"
  • --graph="2026-06-01"
  • --until="2026-06-01"

Explanation: <code>--since</code> filters commits after the specified date. Therefore, it is used for the starting date.

2 Set the End Date

Question
git log --since="2026-04-01" ____
Answer
git log --since="2026-04-01" --until="2026-04-30"

Explanation: <code>--until</code> sets the upper date boundary for commit history.

3 Date Filters

Term Meaning
--since Starting date
--until Ending date
YYYY-MM-DD Year-month-day format
Tarih aralığı Commits between two dates

All lessons in Advanced