Background

Filtering Your Git log Output

August 12, 2018

Git's documentation for the log command is comprehensive. So comprehensive, that it's easy to miss useful flags. Here are some of the those that I've found myself using.

--since and --until

Very easy to understand, these are helpful when you want to specify a time limit between the logs of your commits.

since and until each have an equivalent alternative flag; after and before

Both take a range of date formats, for example:

git log --since "JUL 21 2016" --until "JUL 28 2018"
git log --since="1 month ago"
git log --after="2014-02-12T16:36:00-07:00"
git log --since="2 weeks 3 days 2 hours 30 minutes 59 seconds ago"

--author

Shows only the commits where author matches the pattern supplied. As this is a regex pattern, you can check for commits by multiple authors with a regex or: git log --author='\(Jane\)\|\(Tony\)'

--author can also be aliased to --committer

--grep

Limits log output where the log message matches the regex pattern provided.