What is git show?

Answer

git show displays information about a specific Git object — most commonly used to view a commit's metadata and diff. For commits: git show — show the last commit; git show abc1234 — show a specific commit (hash, author, date, message, and full diff); git show HEAD~2 — show the commit 2 back from HEAD. Output: commit metadata at the top, followed by the diff (+ added lines, - removed lines). Options: --stat — show only file change summary, not full diff; --no-patch — show only commit message, no diff; git show abc1234:src/app.js — show the contents of a file at a specific commit (useful for viewing old versions without checking out). For tags: git show v1.0 — show tag info + the tagged commit. For trees/blobs: git show abc1234^{tree} — show the tree object. Difference from git log -p: git show shows one commit in detail; git log -p shows many commits with their diffs. git show is ideal when you know the exact commit hash and want full details.