One-line format
- Git course
- Beginner
- Lesson 30/80
- 4 min
Learn the compact history with git log --oneline.
One-line history view
git log --oneline displays commit history in a shorter and more readable format. Each commit is shown on one line with a short hash and commit message. The full author and date information is not displayed in this view.
git log --onelineIt is useful for quickly scanning the history of repositories with many commits.
Short and readable output
--oneline is an option added to the git log command. When three commits exist, each appears on a separate line, with its short hash before the message.
git log --oneline
f3a91c2 Initial files
b8d20e1 Add README
a4c12f0 First commitThis view lets you compare commit order and messages at a glance.
Practice Display compact history
Add the --oneline option to git log to list commit history in a compact format.
Starter code
# Kısa commit geçmişini göster
# Komutu buraya yazSample solution
# Kısa commit geçmişini göster
git log --onelineExpected output
kısa hash ve mesaj içeren satırlar listelenir
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which information is shown for each commit in git log --oneline output?
- Full author and date information
- Full contents of files
- Only the commit date
- Short hash and commit message Correct answer
Explanation: The one-line view displays each commit with its short hash and message.
2 Add the one-line option
git log ____
git log --oneline
Explanation: <code>--oneline</code> displays commit history on one line with a short hash and message.
3 Features of the one-line view
| Term | Meaning |
|---|---|
--oneline |
One-line display option |
Kısa hash |
Abbreviated commit identifier |
Mesaj |
Commit description |
Her commit |
Appears on a separate line |