Member-only story
How to Filter the Git Logs
Practical examples of how you can filter the Git logs
Get all commits
We can get the git commit logs with the git log
command.
git log

Get the latest n commits
We can get the latest n commits by running git log -n
. Let’s say that we want to get the latest 2 commits.
git log -2

Get all the commits since a date
We can filter the commits based on time. Let’s say that we want all the commits from 2022–01–17.
git log --since 2022-01-17

Get all the commits until a date
Similarly, we can get all the commits until a specific date as follows:
git log --until 2022-01-16

Get all the commits by an author
We can get all the commits done by a specific author. For example:
git log --author=pipinho13
Get all the commits between two SHAs
We can get the logs between two SHAs as follows:
git log <XXX>...<YYY>