How do you view the commit history with only the commit messages?

How do you view the commit history with only the commit messages?

a) git log --oneline
b) git history --short
c) git log --brief
d) git log --message

Answer:

a) git log --oneline

Explanation:

The git log --oneline command shows the commit history in a compact format, displaying only the commit hash and commit message on a single line for each commit. This makes it easier to quickly browse through the commit history.

For example, running git log --oneline gives a concise overview of the project’s commit history without overwhelming detail.

This command is helpful for reviewing commit messages and identifying relevant commits at a glance.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top