Lesson 13 +15 XP

Git Show

Git Show

git show displays details about a single commit, including what changed in it.

Show the latest commit

git show

This shows the most recent commit: the author, date, message, and the full diff of what changed.

Show a specific commit

git show abc123

Replace abc123 with the commit's hash (you can use just a few characters of it).

Show a file in a commit

git show abc123:index.html

The colon : lets you peek at what a file looked like at that commit.

Show a branch or tag

git show main
git show v1.0

git show works with any name that points to a commit.

When to use show vs diff

  • Use git show to inspect one commit in detail.
  • Use git diff to compare two commits or see current uncommitted changes.

TL;DR

  • git show inspects a single commit.
  • git show hash shows a specific commit.
  • git show hash:file shows a file at that commit.
  • It works with branches and tags too.