I’ll introduce the formats I find convenient and frequently use for the git log command in Git. These formats are specified using the --pretty=format: option. Below, I’ll introduce my favorite format, timestamp + comment format, and comment-only format.
Favorite Format
First, a format customized for my own use. It allows me to instantly grasp the information I frequently look at.
git log --pretty=format:"[%ad] %h %an : %s"
This format displays the following information:
%ad: Commit date and time%h: Short hash of the commit%an: Commit author’s name%s: Commit message
Timestamp + Comment Format
Next, a format that displays only the timestamp and comment. Convenient when you want to simply check the date/time and message.
git log --pretty=format:"[%ad] %s"
This format displays the following information:
%ad: Commit date and time%s: Commit message
Comment-Only Format
Finally, a simple format that displays only comments. Useful when you want to focus on commit messages.
git log --pretty=format:"%s"
This format displays only the commit message %s.
Reference Materials
Please also refer to the following links:
Use these formats to customize the output of the git log command to be more readable.