Tsallaka zuwa abun ciki
Justice Tech School

Inspecting a Commit

git show prints one commit and its diff. --stat summarises changed files and --name-only lists them.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt
echo z > c.txt
git add -A && git commit -qm 'Change two files'
git show --stat --format=%s HEAD | head -4
git show --name-only --format= HEAD

Result

Change two files

 a.txt | 1 +
 c.txt | 1 +
a.txt
c.txt

Exercise

List changed file names.

git show --name- HEAD

Quiz Test

What does --stat print?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.