Git logs play an important role to get details about the activity of the commit. We will learn about git logs in this blog. This blog is the second part of my last blog. I hope you have read my last blog on the same topic. if not please have a look at that blog also, refer to the below link to get that blog-
https://blog.knoldus.com/wp-admin/post.php?post=121261&action=edit
1. –abbrev-commit: Shorten git commit hash-id
Command: git log --abbrev-commit
The full 40-byte hexadecimal commit object name is shortened to default 7-bytes.
Let us club it with the ‘--oneline
‘ option for a convenient view, like so:
Command: git log --abbrev-commit --oneline
What’s more exciting is that you can also specify the byte length of sha-1 ids using the ‘–abbrev=<n>’ option, as shown below:
Command: git log --abbrev-commit --abbrev=5 --oneline
Clearly, the highlighted sha-1 ids are reduced to a 5-byte size.
2. –no-abbrev-commit
Show the full 40-byte hexadecimal commit object name.
This negates –abbrev-commit and those options which imply it such as “–oneline”.
Command: git log --pretty=oneline --no-abbrev-commit
3. –relative-date
Command: git log --relative-date
Kindly note, this highlighted time is subject to change with reference to the time you execute the command on your system.
4. –date=<format>
You can also format the commit git logs date in any of the following format options:
4.1 –date=relative
Command :git log --date=relative
This is synonymous with the above command “git log --relative-date
” and prints the same commits.
4.2 –date=local
Command: git log --date=local
4.3 –date=iso
Command: git log --date=iso
4.5 –date=iso-strict
Command: git log --date=iso-strict
4.6 –date=rfc
Command: git log --date=rfc
4.7 –date=short
Command: git log --date=short
4.8 –date=raw (shows the date in seconds)
Command: git log --date=raw
Print the time as seconds since the unix epoc time ( Jan 01 1970 ) followed by the timezone.
4.9 –date=human
Command: git log --date=human
4.10 –date=unix
Shows the date as unix epoc (UTC) time.
Command: git log --date=unix
Conclusion:
I have covered new commands. I have more command in this below. If you have not read the last blog on the same topic then please follow the below
link– https://blog.knoldus.com/wp-admin/post.php?post=121261&action=edit
Resource – https://www.edureka.co/blog/git-format-commit-history/
