Advent Day 12: git log --since

December 12, 2018

This is day 12 of my Git Tips and Tricks Advent Calendar. If you want to see the whole list of tips as they're published, see the index.

Earlier this month I mentioned how you could the visibility into git's logging with some helpful aliases. But another way to gain visibility into the commits that happened is with the --since option to git log (or git lol if you prefer).

The --since option lets you narrow the history that you're viewing to - well - commits that have occurred since the date that you specify. For example, if you want to see commits that have been committed this year, you can run:

git log --since='2018-01-01'

I've met a number of engineering managers who want to see what their team has been working on over the last few days. I'm not sure that this is a healthy managerial pattern, but git supports that regardless, and you can use the days ago syntax. For example, to see commits in the past few days:

git log --since='two days ago'

And if you're the type of manager who wants to make sure that their employees are relaxing and decompressing instead of working over the weekend:

git log --since='last friday'

Ultimately, understanding how your repository has changed, and how commits have been included in your repository, is important to ensuring that your software is high quality. Thankfully, git log gives you a number of ways to query the history to help understand that.