pretty format
The git log and git show option (--format or --pretty) that sets exactly which fields each commit prints, using placeholders such as %h, %an and %s.
In more detail
%h is the abbreviated ID, %an the author name, %ad the author date, %s the subject and %B the raw message. --date=short prints dates as year-month-day. Scripts use a custom format so their output does not change when Git's default layout does.
Examples
git log --format='%h %an %s'git log --pretty=format:'%h %ad %s' --date=short -3Related terms
- git log — The Git command that lists commits with their identifiers, authors, times and messages.
- --oneline — A flag for git log and git show that prints each commit on one line: its abbreviated ID and its subject.
Taught in
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows