Changes with stat
- Git course
- Beginner
- Lesson 31/80
- 4 min
Learn each commit's changes with git log --stat.
Inspect commit changes
git log --stat lists commit history while also showing which files changed in each commit. The number of inserted and deleted lines appears next to the file names. This lets you see not only the commit message but also the size of each change.
git log --statThis option is used to quickly inspect file changes in the history.
Reading stat output
The --stat output displays file names and change counts together. insertions refers to added lines, while deletions refers to removed lines.
README.md | 5 +++--
app.php | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)Plus signs represent inserted lines, while minus signs represent deleted lines.
Practice Inspect change statistics
Write git log --stat to display commit history with file changes and inserted/deleted line counts.
Starter code
# Commit değişiklik istatistiklerini göster
# Komutu buraya yazSample solution
# Commit değişiklik istatistiklerini göster
git log --statExpected output
dosya değişiklikleri ve satır sayıları listelenir
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What do the inserted and deleted line counts in git log --stat output represent?
- Lines added and removed in the commit Correct answer
- The time taken to create the commit
- The total number of files in the repository
- The number of people who created the commit
Explanation: <code>--stat</code> shows the numbers of lines inserted and deleted in a commit.
2 Display change statistics
git log ____
git log --stat
Explanation: <code>--stat</code> displays file changes and line statistics in commit history.
3 Change statistics
| Term | Meaning |
|---|---|
--stat |
Summarizes file changes |
insertions |
Number of inserted lines |
deletions |
Number of deleted lines |
2 files changed |
Number of changed files |