CodeBlanks Logo Icon CodeBlanks

Changes with stat

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 --stat

This 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

terminal
# Commit değişiklik istatistiklerini göster
# Komutu buraya yaz

Sample solution

terminal
# Commit değişiklik istatistiklerini göster
git log --stat

Expected 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

Question
git log ____
Answer
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

All lessons in Beginner