Git log command

The git log command allows us to see information about all previous commits and status of the head. Each commit has a message attached to it (a commit message), and the git log command prints information about the most recent commits, like their time stamp, the author, and a commit message. This command helps us keep track of what we have been doing and what changes have been saved.

Bash

git log
Your image is not available

Limit on git log

By default, if no argument passed, Git log shows the most recent commits first. We can limit the number of log entries displayed by passing a number as an option, such as -3 to show only the last three entries.

Bash

git log -3

git log --oneline

The oneline option is used to display the output as one commit per line, i.e. more concise way of listing the commits.

It will be used as follows:

Bash

git log --oneline

So, usually we can say that the --oneline flag causes git log to display:
o one commit per line
o the first seven characters of the SHA
o the commit message