AI Hints
Home›Git & GitHub Tutorial›Seeing Changes
Git & GitHub · Lesson 18 of 144

Looking Inside a Commit

Git show.

⏱ 2 min read▶ Video at 18:19🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Diff shows changes you haven't committed yet. But what about changes you committed last week? Git show opens any commit, and shows exactly what it changed.

Looking Inside a Commit
From the video: Looking Inside a Commit
  • What did that commit change?
  • git show opens any commit
  • Its message, and its diff

git show

Git show, on its own, opens the most recent commit. First, the same details as the log. Then the diff, so we can see this commit added one line, the link to the about page.

git
git show
commit f63a17af33cd97f30d014023639480f94ef09578 (HEAD -> main)
Author: Sam Lee <sam@example.com>
Date:   Mon Jan 5 09:25:07 2026 +0000

    Link to about page

diff --git a/index.html b/index.html
index 5850ab3..93dd595 100644
--- a/index.html
+++ b/index.html
@@ -1,2 +1,3 @@
 <h1>My Site</h1>
 <p>Welcome!</p>
+<a href="about.html">About</a>

Any commit you like

To open an older commit, give its hash. In the short log, the welcome text commit is zero b a six zero four nine. Git show, with that hash, shows the welcome line it added.

git
git log --oneline
f63a17a (HEAD -> main) Link to about page
ef9c947 Add basic styles
6784119 Add about page
0ba6049 Add welcome text
f7d9757 Add home page
git show 0ba6049
commit 0ba60493a48cb096b47f4185907bdd36bfbed69c
Author: Sam Lee <sam@example.com>
Date:   Mon Jan 5 09:11:25 2026 +0000

    Add welcome text

diff --git a/index.html b/index.html
index d6cb22f..5850ab3 100644
--- a/index.html
+++ b/index.html
@@ -1 +1,2 @@
 <h1>My Site</h1>
+<p>Welcome!</p>

Summary

git show displays any commit, its details and its diff. On its own, it shows the latest one. Next, adding, deleting and renaming files.

Key takeaways
  • git show: the latest commit
  • git show <hash>: any commit
  • Details plus diff
Next up: Adding, Removing, Renaming — git rm and git mv