Skip to content
Justice Tech School

Looking Inside a Commit

git show prints a commit and its changes. HEAD~1 is the parent.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt && git commit -qam 'second'
git show HEAD --stat --format=%s | head -n 1
git show HEAD~1:a.txt

Result

second
one

Exercise

Parent of HEAD.

HEAD1

Quiz Test

What is HEAD?

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