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 https://git-scm.com/book/en/v2/. From this book I had followed chapter https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History to study more about git log command.
git log is used without any argument, it displays all previous commits in reverse chronological order.
We can provide following arguments with
git log command to see different outputs formats.
-n is passed as an argument, where n is number it would show n number of commits.
--patch is passed as an argument, it shows difference or patch output between each commit
--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.