As part of home task part 2, we were asked to read about git log command. So this blog post is dedicated to that. To get more info about git log command I had gone through Git pro book available at From this book I had followed chapter to study more about git log command.

When git log is used without any argument, it displays all previous commits in reverse chronological order.

$ git log

We can provide following arguments with git log command to see different outputs formats.

  • When -n is passed as an argument, where n is number it would show n number of commits.
$ git log -5
  • When -p or --patch is passed as an argument, it shows difference or patch output between each commit
$ git log -p -5
  • --stat is used get abbreviated stats of each commits
$ git log --stat
$ git log --stat -2
  • --since=<date> is used get logs from a particular time. One can pass months, years, days, hours etc to get log from that particular time.
$ git log --since="2 hours"
$ git log --since="3 day"
$ git log --since="10 weeks"
$ git log --since="1 year"
  • --author=<pattern> is used get logs from one or many authors.
$ git log --author="Bhavesh"

Bonus Video: Thanks for reading the post check out this video on youtube explaining how git works internally.